I have the following small function that does not compile:
function f_query_01 Return interval Day to second is
start_time timestamp(3);
end_time timestamp(3);
time_diff interval Day to second;
c_query_number number;
begin
start_time := systimestamp;
select count(*) into c_query_number from wg; <--This is the line that errors out
end_time := systimestamp;
time_diff := start_time - end_time;
return time_diff;
end f_query_01;
The compiler gives me the following errors:
Error(29,3): PL/SQL: SQL Statement ignored
Error(29,44): PL/SQL: ORA-04044: procedure, function, package, or type is not allowed here
What is causing this error and how can I fix it?
You have an extraneous DECLARE -- you would only use that if you are declaring a PL/SQL block that doesn't involve a CREATE . You are missing semicolons after your RETURN statements. A procedure cannot return a value.
Both EXIT and CONTINUE have an optional WHEN clause, where you can specify a condition. Sequential control statements, which are not crucial to PL/SQL programming. The sequential control statements are GOTO , which goes to a specified statement, and NULL , which does nothing.
The function SQLERRM returns the error message associated with its error-number argument. If the argument is omitted, it returns the error message associated with the current value of SQLCODE . SQLERRM with no argument is useful only in an exception handler.
It appears the table wg does not exist. When updated to the correct table name the compile works without errors. A message from the compiler of table does not exist would be most helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With