Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

EXECUTE IMMEDIATE

Abhisek SamantaDec 13 2016 — edited Mar 8 2017

Hi ,

I've the following piece of code with a simple EXECUTE IMMEDIATE usage . PFb code :

-----------------------

declare

v_a varchar2(10);

begin

/*EXECUTE IMMEDIATE 'SELECT TRUNC(EVT_DTTM), COUNT(*) FROM ' || v_tabr || ' GROUP BY TRUNC(EVT_DTTM) '

INTO v_date, v_received;

*/ ( This works fine )

EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM temp_manto'|| into v_a; --- This is the new line where I'm facing the error .

EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM'|| temp_manto into v_a; --- Same line with quotes in different place throwing error.

Exception

when NO_DATA_FOUND then

dbms_output.put_line(v_a);

end;

/

-----------------------------

Error :

Error report:

ORA-06550: line 11, column 55:

PLS-00103: Encountered the symbol "INTO" when expecting one of the following:

   ( - + case mod new null <an identifier>

   <a double-quoted delimited-identifier> <a bind variable>

   continue avg count current max min prior sql stddev sum

   variance execute forall merge time timestamp interval date

   <a string literal with character set specification>

   <a number> <a single-quoted SQL string> pipe

   <an alternatively-quoted string literal with character set specification>

   <an alternatively-quoted

06550. 00000 -  "line %s, column %s:\n%s"

*Cause:    Usually a PL/SQL compilation error.

*Action:

My question is : Which parts of the query we need to put in quotes and which not. Pl suggest what should be the correct statement .

Thanks in advance

This post has been answered by Frank Kulash on Dec 13 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2017
Added on Dec 13 2016
5 comments
936 views