dynamic ERROR

tarzan

Member
hi all !

give me hint, please, what should I do?

I use dynamic query in my pl/sql proc.

when i try use bind var.
------
sql_stmt := 'CREATE OR REPLACE VIEW frm15 AS
SELECT c.idalc
FROM alc c, alm p
WHERE ((p.lcnt = idalc AND p.dat >= TO_DATE(:x )) OR
(p.pcnt = idalc AND p.dat >= TO_DATE(:x)))
AND c.idalc = 431';

EXECUTE IMMEDIATE sql_stmt USING l_dati;
---
I receive erorr:

ORA-01027: bind variables not allowed for data definition operations

and when i try
---
stmt := 'CREATE OR REPLACE VIEW frm15 AS
SELECT c.idalc
FROM alc c, alm p
WHERE ((p.lcnt = idalc AND p.dat >= TO_DATE('| |l_dati| |')) OR
(p.pcnt = idalc AND p.dat >= TO_DATE('| |l_dati| |')))
AND c.idalc = 431';
I receive other error:
---
ORA-00907: missing right parenthesis

--
thanks.
 
Does your l_dati variable contain quotes? The to_date argument should be surrounded by quotes (unlike the implementation with bind variables).

------------------
Marco Kalter
Allround Automations
 
Back
Top