Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: execute immediate 'insert into ...'
Joe,
Try this:
execute immediate 'insert into test values (' ||
2 || '''' || ',' || '''' ||
'joe' || '''' || ',' || '''' ||
'07-JUN-05' || ')';
The nest way to test this is to select the above string from dula to see if it is formatted correctly:
Select 'insert into test values (' ||
2 || '''' || ',' || '''' ||
'joe' || '''' || ',' || '''' ||
'07-JUN-05' || ')'
If the quotes look correct, then try executing it.
Tom
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Joe Smith
Sent: Friday, September 09, 2005 10:31 AM
To: oracle-l_at_freelists.org
Subject: execute immediate 'insert into ...'
I am trying to insert records into a table through execute immediate.
The
number datatypes go in with no problem. It is the varchar2 and date
formats
that are giving me a problem.
examples:
desc tables test
col1 number,
col2 varchar2(30)
col3 date
execute immediate 'insert into test values ('|| 2 ||', '|| joe ||', '||
07-JUN-05 ||')';
I have tried different ways to format the varchar2 and date datatype,
but
keeps giving me an error.
How do I format these datatypes within an execute immediate?
thanks.
-- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-lReceived on Fri Sep 09 2005 - 09:52:00 CDT