Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fix this "SQL Statement ignored" error?

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?

like image 734
twamn Avatar asked Jun 24 '10 19:06

twamn


People also ask

What is PLS 00103 error in PL SQL?

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.

Where can exit and continue appear inside PL SQL?

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.

What is Sqlerrm and Sqlcode?

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.


1 Answers

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.

like image 107
twamn Avatar answered Oct 18 '22 19:10

twamn