Skip to Main Content

APEX

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!

Issuing an Execute Immediate command within an Apex Process

439391Jan 24 2007 — edited Jan 24 2007
Hi,

Hoping someone can assist:

I currently have this value in v_sql, i.e:

'insert into test_app_info
(BA_ID,BA_APP_ID,ACTIVE,BAI_STRING_1,BAI_STRING_2,BAI_STRING_3,BAI_STRING_4,BAI_STRING_5,BAI_STRING_6,BAI_STRING_7,BAI_STRING_8,BAI_STRING_9,BAI_STRING_10,BAI_STRING_11,BAI_STRING_12)
values (1,1,''Y'',''LAS'',''LAS'',''AXEM'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)'

notice the start and end single quotes as part of the value.

Within my Apex process though, I have the following code in a BEGIN END block,

i.e:
BEGIN
. . .
. . . .
IF v_ins_stmnt IS NOT NULL THEN
v_sql := ''''||v_ins_stmnt||'''';
execute immediate v_sql;
COMMIT;
END IF;
END;

When I run the page, I get a ORA-00900: invalid SQL statement but if I take the value of v_sql above and run it through sqlplus using the following command:

begin
execute immediate 'insert into test_app_info
(BA_ID,BA_APP_ID,ACTIVE,BAI_STRING_1,BAI_STRING_2,BAI_STRING_3,BAI_STRING_4,BAI_STRING_5,BAI_STRING_6,BAI_STRING_7,BAI_STRING_8,BAI_STRING_9,BAI_STRING_10,BAI_STRING_11,BAI_STRING_12)
values (1,1,''Y'',''LAS'',''LAS'',''AXEM'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)';
end;
/

all works fine....!!!

Any ideas as to why Apex may not like what I am doing or I have missed something?

Thanks.
Tony.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 21 2007
Added on Jan 24 2007
5 comments
756 views