Home » SQL & PL/SQL » SQL & PL/SQL » Writing EXECUTE IMMEDIATE (SQL Developer 1.5.1)
Writing EXECUTE IMMEDIATE [message #407415] Wed, 10 June 2009 02:32 Go to next message
ramaswamy.kandada@gmail.c
Messages: 1
Registered: June 2009
Location: Pune
Junior Member
Hello every one..

In a package I wrote the following statement

EXECUTE IMMEDIATE 'INSERT INTO ME_DATES (cob_date) (select distinct greg_dte from ft_t_cadp where cal_id = 'PRPTUAL' and mth_end_ind = 'Y')';

When I am compiling the package it is throwing me an exception like

Error(479,112): PLS-00103: Encountered the symbol "PRPTUAL" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem return returning <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between into using || multiset bulk member SUBMULTISET_

when I am compiling the package with out giving the where condition but it is a requirement to put that condition.
Can you pls let me what is the problem with my statment.
Thanks in Advance

Ramu Kandada
Re: Writing EXECUTE IMMEDIATE [message #407419 is a reply to message #407415] Wed, 10 June 2009 02:44 Go to previous messageGo to next message
bonker
Messages: 402
Registered: July 2005
Senior Member
Why do you need dynamic SQL for this? you can just use plain static sql like this in the code.

INSERT INTO ME_DATES (cob_date) 
(select distinct greg_dte from ft_t_cadp where cal_id = 'PRPTUAL' and mth_end_ind = 'Y')

[Updated on: Wed, 10 June 2009 02:49] by Moderator

Report message to a moderator

Re: Writing EXECUTE IMMEDIATE [message #407420 is a reply to message #407415] Wed, 10 June 2009 02:45 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Double the quote (don't use double-quotes) for the constant strings inside the statement string.

By the way, as all things are constant there is no dynamic part, you don't need dynamic SQL.

Regards
Michel

[Updated on: Wed, 10 June 2009 02:48]

Report message to a moderator

Previous Topic: how to add same account number debit n credits
Next Topic: merging of sql scripts
Goto Forum:
  


Current Time: Sun Dec 04 08:53:49 CST 2016

Total time taken to generate the page: 0.11329 seconds