EXECUTE IMMEDIATE ERROR ..
Kidnly somebody suggest me how to wirte below query in execute immediate in pl/sql block as it throwing below error
CREATE OR REPLACE PROCEDURE LBA_NORTH
AS
BEGIN
execute immediate ( 'CREATE TABLE LBA_ALERT(DATE_CRT,DIST_MSISDN,FOS_MSISDN,RT_COUNT,RT_SERIES)TABLESPACE PRTP_INDX1 AS
SELECT TO_CHAR(LMA.DATE_CRT,'DD-MON-YY'), LMP.DIST_MSISDN,LMA.FOS_MSISDN,COUNT(LMA.RT_MSISDN)RT_COUNT,
RTRIM (xmlagg (xmlelement (e, LMA.RT_MSISDN || ',')).extract ('//text()'), ',')AS RT_SERIES
FROM LBA_Mapping LMP,LBA_Master LMA
WHERE LMP.DIST_MSISDN=LMA.DIST_MSISDN
GROUP BY LMP.DIST_MSISDN,LMA.FOS_MSISDN,TO_CHAR(LMA.DATE_CRT,'DD-MON-YY')');
END;
LINE/COL ERROR
5/30 PLS-00103: Encountered the symbol "DD" when expecting one of the
following:
) , * & | = - + < / > at in is mod remainder not rem => ..
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
The symbol "," was substituted for "DD" to continue.
5/39 PLS-00103: Encountered the symbol "),
LMP.DIST_MSISDN,LMA.FOS_MSISDN,COUNT(LMA.RT_MSISDN)RT_COUNT,
" when expecting one of the following:
. ( ) , * @ % & | = - + < / > at in is mod remainder not rem
LINE/COL ERROR
=> .. <an exponent (**)> <> or != or ~= >= <= <> and or like
LIKE2_ LIKE4_ LIKEC_ between || member SUBMULTISET_
The symbol "(" was substituted for "),
LMP.DIST_MSISDN,LMA.FOS_MSISDN,COUNT(LMA.RT_MSISDN)RT_COUNT,
" to continue.
6/65 PLS-00103: Encountered the symbol "/" when expecting one of the
following:
( - + case mod new null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current max min prior sql stddev sum variance execute
LINE/COL ERROR
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 SQL string>
6/72 PLS-00103: Encountered the symbol "), " when expecting one of the
following:
. ( ) , * % & | = - + < / > at in is mod remainder not rem =>
.. <an exponent (**)> <> or != or ~= >= <= <> and or like
LINE/COL ERROR
LIKE2_ LIKE4_ LIKEC_ between || member SUBMULTISET_
Edited by: user3558544 on Mar 28, 2013 4:52 AM
And by the way...
user3558544 wrote:
Kidnly suggest immediately
This is a forum of volunteers who have their own jobs to do. Suggesting they respond immediately or ugently is considered downright rude, not just to those volunteers but also to all the other people who would like a quick answer to their questions (but who haven't been rude).
Read: {message:id=9360002}
Similar Messages
-
Error while insert data using execute immediate in dynamic table in oracle
Error while insert data using execute immediate in dynamic table created in oracle 11g .
first the dynamic nested table (op_sample) was created using the executed immediate...
object is
CREATE OR REPLACE TYPE ASI.sub_mark AS OBJECT (
mark1 number,
mark2 number
t_sub_mark is a class of type sub_mark
CREATE OR REPLACE TYPE ASI.t_sub_mark is table of sub_mark;
create table sam1(id number,name varchar2(30));
nested table is created below:
begin
EXECUTE IMMEDIATE ' create table '||op_sample||'
(id number,name varchar2(30),subject_obj t_sub_mark) nested table subject_obj store as nest_tab return as value';
end;
now data from sam1 table and object (subject_obj) are inserted into the dynamic table
declare
subject_obj t_sub_mark;
begin
subject_obj:= t_sub_mark();
EXECUTE IMMEDIATE 'insert into op_sample (select id,name,subject_obj from sam1) ';
end;
and got the below error:
ORA-00904: "SUBJECT_OBJ": invalid identifier
ORA-06512: at line 7
then when we tried to insert the data into the dynam_table with the subject_marks object as null,we received the following error..
execute immediate 'insert into '||dynam_table ||'
(SELECT887684 wrote:
ORA-00904: "SUBJECT_OBJ": invalid identifier
ORA-06512: at line 7The problem is that your variable subject_obj is not in scope inside the dynamic SQL you are building. The SQL engine does not know your PL/SQL variable, so it tries to find a column named SUBJECT_OBJ in your SAM1 table.
If you need to use dynamic SQL for this, then you must bind the variable. Something like this:
EXECUTE IMMEDIATE 'insert into op_sample (select id,name,:bind_subject_obj from sam1) ' USING subject_obj;Alternatively you might figure out to use static SQL rather than dynamic SQL (if possible for your project.) In static SQL the PL/SQL engine binds the variables for you automatically. -
Error in execute immediate statement
i am writing a stored procedure i am getting error
v_Sql NVARCHAR2(1500);
BEGIN
v_Sql := 'Select * from vw_FillPatient Where 1 = 1 ';
IF v_pVisitTypeID <> 0 THEN
v_Sql := v_Sql || ' AND VisitTypeID = ' || CAST(v_pVisitTypeID AS VARCHAR2) || '';
ELSE
IF v_pVisitTypeID = 0 THEN
v_Sql := v_Sql || ' AND VisitTypeID In (1,2,6)';
END IF;
END IF;
v_Sql := v_Sql || ' AND VisitDate between ''' || TO_CHAR(v_pFromDate,'''DD_MON_YYYY''')
|| ''' and ''' || TO_CHAR(v_pToDate,'''DD-MON-YYYY''') || '''';
v_Sql := v_Sql || ' ORDER BY VisitID ';
EXECUTE IMMEDIATE v_Sql;-- error in this line as shown by SQL Developer
end;
error
Error(64,22): PLS-00382: expression is of wrong typev_Sql NVARCHAR2(1500);
BEGIN
V_SQL := 'Select * from vw_FillPatient Where 1 = 1 ';
IF V_PVISITTYPEID=0 THEN
v_Sql := v_Sql || ' AND VisitTypeID = ''' || CAST(v_pVisitTypeID AS VARCHAR2) || '''';
ELSE
IF v_pVisitTypeID = 0 THEN
v_Sql := v_Sql || ' AND VisitTypeID In (1,2,6)';
END IF;
END IF;
V_SQL :=
V_SQL || ' AND VisitDate between to_date(''' ||V_PFROMDATE||''',''DD-MON-YYYY'') and '
|| 'to_date('''||v_pToDate||''',''DD-MON-YYYY'')';
v_Sql := v_Sql || ' ORDER BY VisitID ';
EXECUTE IMMEDIATE v_Sql;-- error in this line as shown by SQL Developer
END;try it , please
I think your V_PFROMDATE, and V_PTODATE is varchar
elsif V_PFROMDATE and V_PTODATE id date then
V_SQL || ' AND VisitDate between to_date(''' ||to_char(V_PFROMDATE,'DD-MON-YYYY')||''',''DD-MON-YYYY'') and '
|| ' to_date('''||to_char(v_pToDate,'DD-MON-YYYY')||''',''DD-MON-YYYY'')';Edited by: Mahir M. Quluzade on Mar 1, 2011 11:15 AM
Edited by: Mahir M. Quluzade on Mar 1, 2011 11:22 AM -
Error while using execute immediate
Hi,
I am trying to get the record count of a table. The table name is saved in a variable..
when i am writing the code like below its working fine.
SELECT count(*) into count1 FROM emp1;
DBMS_OUTPUT.PUT_LINE(count1);
but when i am using the code for the table name in variable its giving error
execute immediate 'SELECT count(*) into count1 FROM ' || t_name;
DBMS_OUTPUT.PUT_LINE(count1);
the error is
ERROR at line 1:
ORA-00905: missing keyword
ORA-06512: at "SYSTEM.TEST_COL", line 14
ORA-06512: at line 1
any help
AshishInteresting, the into count doesn't be a problem, but the count variable usage does :
SQL> set serveroutput on
SQL> l
1 declare
2 count number;
3 t_name varchar2(30):='all_objects';
4 begin
5 execute immediate 'select count(*) from ' || t_name into count;
6 exception when others then dbms_output.put_line(sqlcode||' : '||sqlerrm);
7* end;
SQL> /
PL/SQL procedure successfully completed.
SQL> declare
2 count number;
3 t_name varchar2(30):='all_objects';
4 begin
5 execute immediate 'select count(*) from ' || t_name into count;
6 dbms_output.put_line(count);
7 exception when others then dbms_output.put_line(sqlcode||' : '||sqlerrm);
8* end;
SQL> /
dbms_output.put_line(count);
ERROR at line 6:
ORA-06550: line 6, column 25:
PLS-00204: function or pseudo-column 'COUNT' may be used inside a SQL statement
only
ORA-06550: line 6, column 4:
PL/SQL: Statement ignoredNicolas. -
I want to mirror a schema to a existing schema by creating DDL and recreate on the other schema with same name.
I wrote the code below:
create or replace
PROCEDURE SCHEMA_A."MAI__DWHMIRROR"
AS
v_sqlstatement CLOB:='bos';
str varchar2(3999);
BEGIN
select
replace(
replace(replace(
replace(DBMS_METADATA.GET_DDL('TABLE','XXXX','SCHEMA_A'),'(CLOB)',''),';','')
,'SCHEMA_A'
,'SCHEMA_B'
into v_sqlstatement
from dual;
select CAST(v_sqlstatement AS VARCHAR2(3999)) into str from dual;
execute immediate ''||str;
END;
And Executing this block with below code:
set serveroutput on
begin
SCHEMA_A.MAI__DWHMIRROR;
end;
But still getting the following error code:
Error report:
ORA-01031: insufficient privileges
ORA-06512: at "SCHEMA_A.MAI__DWHMIRROR", line 47
ORA-06512: at line 2
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label.user5199319 wrote:
USER has DBA Role
when all else fails Read The Fine Manual
DBMS_METADATA -
Error in PL/SQL - execute immediate
Hi ,
I am getting this error when executing the procedure.Could you help me what wrong in it?
SQL >create or replace procedure delete_emp_copy (tname in varchar2) is
sql_stmt varchar2(200);
begin
sql_stmt :='delete from :1';
execute immediate sql_stmt using tname;
end;
Procedure created
.SQL> execute delete_emp_copy('EMPLOYEES_COPY');
BEGIN delete_emp_copy('EMPLOYEES_COPY'); END;
ERROR at line 1:
ORA-00903: invalid table name
ORA-06512: at "HR.DELETE_EMP_COPY", line 5
ORA-06512: at line 1
EMPLOYEES_COPY exists in my schema? what could be wrong?You can't bind in a table name. You would have to concatenate the table name. Youd can use bind variables for values in the where clause, for example, but not for object names.
create or replace procedure delete_emp_copy (tname in varchar2) is
sql_stmt varchar2(200);
begin
sql_stmt :='delete from ' || tname;
execute immediate sql_stmt;
end;I'd recommend you to validate the table name, using a select from all_tables to check if it exists, or using the DBMS_ASSERT if your Oracle version supports it. -
Error on execute immediate statement ?
declare
v_statement VARCHAR2(500);
CURSOR Mov_Tab_to_ERP_Tbsp
IS
select t.table_name
from user_tables t
where t.tablespace_name='SYSTEM' or t.tablespace_name='USER';
BEGIN
FOR y IN Mov_Tab_to_ERP_Tbsp
LOOP
/* Build the statement */
v_statement := 'Alter table ' || y.table_name ||' Move tablespace ERP;';
execute immediate v_statement;
END LOOP;
END;
I am getting the error of
ORA-00911: invalid character
ORA-06512: at line 14
it is correct by the book....what could be the reason. ...Thanks in advance.Hi,
try below given code
DECLARE
v_statement VARCHAR2 (500);
CURSOR mov_tab_to_erp_tbsp
IS
SELECT t.table_name
FROM user_tables t
WHERE t.tablespace_name = 'SYSTEM' OR t.tablespace_name = 'USER';
BEGIN
FOR y IN mov_tab_to_erp_tbsp
LOOP
/* Build the statement */
v_statement :=
'Alter table ' || y.table_name || ' Move tablespace ERP';/* removed ';'*/
EXECUTE IMMEDIATE v_statement;
END LOOP;
END;*009* -
Execute immediate column not allowed here error
Hi,
I have the following procedure
CREATE OR REPLACE PROCEDURE SWF_ICD
IS
SEQSWF NUMBER;
req VARCHAR2(1000):='';
BEGIN
DBMS_OUTPUT.ENABLE( 1000000 ) ;
DBMS_OUTPUT.PUT_LINE('DEBUT');
FOR CUR1 IN (SELECT * FROM ICD WHERE ETAICD=5)
LOOP
SELECT SEQ_SWF.NEXTVAL INTO SEQSWF FROM DUAL;
FOR CUR2 IN (SELECT CODCSWSSW,CODSSW,RUBSSW FROM SSW,OSW
WHERE INSOSW='ICD' AND CODCSWSSW=CODCSWOSW)
LOOP
req:= 'INSERT INTO SWF (SEQESWSWF,CODCSWSWF,CODSSWSWF,VALSWF) '
|| 'VALUES (CUR2.SEQSWF,CUR2.CODCSWSSW,CUR2.CODSSW,CUR1.' || CUR2.RUBSSW || ')';
DBMS_OUTPUT.PUT_LINE('req : ' || req);
EXECUTE IMMEDIATE req;
END LOOP;
END LOOP;
DBMS_OUTPUT.PUT_LINE('FIN');
END;
The procedure is created but when running i have the following error column not allowed here.
pls advise.Hi
Try EXECUTE IMMEDIATE sql USING ... syntax.
EXECUTE IMMEDIATE dynamic_string
[INTO {define_variable[, define_variable]... | record}]
[USING [IN | OUT | IN OUT] bind_argument
[, [IN | OUT | IN OUT] bind_argument]...]
[{RETURNING | RETURN} INTO bind_argument[, bind_argument]...];
Please see the link for more info.
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/11_dynam.htm#13131
Thanks -
Error when running execute immediate to create synonym in Procedure
The following command
execute immediate 'create synonym EW6379_DM.kbr_v_tag_eq_new_tags for EW6379.kbr_v_tag_eq_new_tags';
runs fine if executed outside in a Stored procedure,
but if I add this command to a Procedure will fails with error ORA-01031 insuficient Privilegies
Very strange.Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as SYS
SQL>
SQL> drop role r1;
Role dropped
SQL> drop user u1 cascade;
User dropped
SQL> create user u1 identified by u1;
User created
SQL> grant connect, resource to u1;
Grant succeeded
SQL> create role r1;
Role created
SQL> grant create any synonym to r1;
Grant succeeded
SQL> grant create any procedure to r1;
Grant succeeded
SQL> grant r1 to u1;
Grant succeeded
SQL> conn u1/u1;
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as u1
SQL> create table t(i number);
Table created
SQL> create synonym s for t;
Synonym created
SQL> create table t2(i number);
Table created
SQL> create or replace procedure p
2 is
3 begin
4 execute immediate 'create synonym s2 for t2';
5 end;
6 /
Procedure created
SQL> show err;
No errors for PROCEDURE U1.P
SQL> exec p;
begin p; end;
ORA-01031: insufficient privileges
ORA-06512: at "U1.P", line 4
ORA-06512: at line 1
SQL> conn sys/0000 as sysdba;
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as SYS
SQL> grant create any synonym to u1;
Grant succeeded
SQL> conn u1/u1;
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as u1
SQL> exec p;
PL/SQL procedure successfully completed
SQL> -
Procedure using EXECUTE IMMEDIATE facing error
Hi,
I have a procedure proc_1;
Create or replace proc_1
as
sql_1 varchar2(32767) := 'ANALYZE TABLE INFO COMPUTE STATITICS;';
sql_2 varchar2(32767) := 'ANALYZE TABLE TEST COMPUTE STATITICS;';
Begin
EXECUTE IMMEDIATE sql_1;
EXECUTE IMMEDIATE sql_2;
End;
I get an invalid character error.
How to solve this?
Is the procedure written proper ?
Please guide.
Thanks.Hi Amm-K!
<pre>
Create or replace proc_1
as
sql_1 varchar2(32767) := 'ANALYZE TABLE INFO COMPUTE STATITICS';
sql_2 varchar2(32767) := 'ANALYZE TABLE TEST COMPUTE STATITICS';
Begin
EXECUTE IMMEDIATE sql_1;
EXECUTE IMMEDIATE sql_2;
End;
</pre>
Remove the ; between STATISTICS and ' like in the above example.
yours sincerely -
Invalid Table Name error in EXECUTE IMMEDIATE
Hi there.
I am trying to truncate few debug tables I created a used ago. Refer the code
declare
lv_sql varchar2(100) := 'truncate table :b1';
begin
for i in (select object_name
from all_objects
where object_type = 'TABLE'
and object_name like 'DEBUG_%'
and owner = user)
loop
dbms_output.put_line('Table Name: '||i.object_name);
execute immediate lv_sql using i.object_name;
end loop;
end;Seems to be correct (unless I messed something big). And, I get an error message:
ORA-00903: invalid table name
ORA-06512: at line 13Any idea? Thanks in advance.you can't bind table or column names... try this instead:
declare lv_sql varchar2(100);
begin for i in (select object_name
from all_objects
where object_type = 'TABLE'
and object_name like 'DEBUG_%'
and owner = user) loop
dbms_output.put_line('Table Name: '||i.object_name);
lv_sql := 'truncate table '||i.object_name;
execute immediate lv_sql;
end loop;
end;Message was edited by:
RACER
forgot ending tag -
Error on converting EXECUTE IMMEDIATE from oracle to SQL
Hi,
I am converting db from oracle to SQL using SSMA.
I get following error while converting schema-
This is the statement on source side (oracle) which is giving below error -EXECUTE IMMEDIATE sqlStat INTO objects_count;
* SSMA error messages:
* O2SS0013: EXECUTE IMMEDIATE statement was converted into EXEC(...) statement, but dynamic string was not converted. It must be converted manually.
EXECUTE (@sqlStat)
Another issue is that I get below warning when converting this - temHEX NUMBER;
from oracle to sql.
* SSMA warning messages:
* O2SS0356: Conversion from NUMBER datatype can cause data loss.
It is converting to this in SQL - @temHEX float(53),
Please suggest.
Thanks.Hi,
I faced same error again-
Below is the EXECUTE IMMEDIATE statement. Please help.
* SSMA error messages:
* O2SS0013: EXECUTE IMMEDIATE statement was converted into EXEC(...) statement, but dynamic string was not converted. It must be converted manually.
EXECUTE (
'insert into Table1 (C_REPORTNAME,C_REPORTCODE,C_DATE,C_WEEK,C_MONTH,C_YEAR,'
+
ISNULL(@sColumnNames, '')
+
') values ('''
+
ISNULL(@sReportName, '')
+
+
ISNULL(@sReportCode, '')
+
+
ISNULL(CAST(@dInputDate AS nvarchar(max)), '')
+
+
ISNULL(@sWeekNumber, '')
+
+
ISNULL(@sMonth, '')
+
+
ISNULL(@sYear, '')
+
+
ISNULL(@sName, '')
+
+
ISNULL(@sDescription, '')
+
+
ISNULL(CAST(@nFail_Count AS nvarchar(max)), '')
+
+
ISNULL(CAST(@nPass_Count AS nvarchar(max)), '')
+
+
ISNULL(CAST(@nPassing_Fraction AS nvarchar(max)), '')
+
+
ISNULL(@sEnabled, '')
+ -
Error in code while using Execute immediate
Hi,
Mentioned below is my script, when i am trying to execute it its saying
ORA-00911: invalid character
ORA-06512: at line 17
which is acctually EXECUTE IMMEDIATE statement.
Please help me out to resolve it.
Declare
v_tab VARCHAR2(500);
s_sql VARCHAR2(1500);
cntr NUMBER := 1;
v_num NUMBER;
CURSOR c1 IS SELECT object_name FROM dba_objects
WHERE object_type = 'TABLE' AND OBJECT_NAME LIKE 'FND%'AND ROWNUM<20;
VC1 C1%ROWTYPE;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO VC1;
EXIT WHEN C1%NOTFOUND;
v_tab := VC1.object_name;
s_sql := ' SELECT COUNT(*) into v_num FROM ' || v_tab||';';
dbms_output.put_line(v_tab ||' '|| s_sql);
EXECUTE IMMEDIATE s_sql INTO V_NUM;
dbms_output.put_line(v_num);
END LOOP;
CLOSE C1;
END;
Regards
Amits_sql := ' SELECT COUNT(*) into v_num FROM ' || v_tab||';';Try changing that line as follows :
s_sql := ' SELECT COUNT(*) FROM ' || v_tab; -
Strange Case on Security Rights and Dynamic SQL (Execute Immediate)
Hi friends, (forgive me if I write with wrong grammar and sentence, I not used English for daily)
I got a weird trouble yesterday.
I created a package (we can called it X, OK!?) which containing Execute Immediate Statement, that function to delete a table (we can called it Y).
Several days ago, it's worked, but yesterday it wasn't. Last things happened before was recreate those table, and regrant to a role which including user account that execute package X.
Error Msg shown is ORA-00942 : Table or view does not exist. After rechecked and rechecked, I found nothing that could trigger that error, I used DBMS_OUTPUT.PUT_LINE to debug and show what statement resulted and executed, I cut and paste, and it's worked. I created anonymous PL/SQL Block, and wrote it and executed it, and worked.
Finally, today, We Grant explicitly those table to user account Y, not via Role, ... and it's work. Interesting thing I think :P
And, I revoke, execute package and run. I think, there's something about Oracle he..he.. :D .
Can somebody help me and explain me the reason of that strange symptomp? and right solution? I must know it, because several days again, it's launched / install.
TIAHere is the procedure that get troubled into :)
PROCEDURE DeleteOld_Job(
p_Job_Code IN VARCHAR2,
p_User_Id IN VARCHAR2,
p_Parameter_Entry IN VARCHAR2,
p_Status OUT NUMBER )
IS
StrSql VARCHAR2(1000);
CURSOR CTable_Used_By_Report IS
SELECT TABLE_NAME
,TABLE_OWNER
FROM TABLE_USED_BY_JOB
WHERE
Job_Code = p_Job_Code
BEGIN
p_Status := 1;
DBMS_OUTPUT.PUT_LINE('p_Job_Code '| |p_Job_Code );
DBMS_OUTPUT.PUT_LINE('p_Parameter_Entry '| |p_Parameter_Entry );
FOR Item IN CTable_Used_By_Report
LOOP
StrSql := 'DELETE '| |Item.TABLE_OWNER| |'.'| |Item.TABLE_NAME| |' T WHERE EXISTS ( SELECT 1 FROM USERBATCH.HISTORY_JOB H WHERE H.USER_ID = ' ;
StrSql := StrSql| |''''| |p_User_Id| |''''| |' AND H.Job_Code = '| |''''| |p_Job_Code| |''''| |' AND H.PARAMETER_ENTRY = '| |'''' | |p_Parameter_Entry| |''''| |' AND T.SESSION_ID = H.TRANSACTION_ID)';
DBMS_OUTPUT.PUT_LINE(StrSql);
DBMS_OUTPUT.PUT_LINE(Item.TABLE_OWNER| |'.'| |Item.TABLE_NAME);
EXECUTE IMMEDIATE StrSql;
END LOOP;
DBMS_OUTPUT.PUT_LINE('DELETE USERBATCH.HISTORY_JOB WHERE USER_ID ='''| | p_User_Id | |'''
AND Job_Code ='''| | p_Job_Code | |''' AND PARAMETER_ENTRY = '''| | p_Parameter_Entry | |'''');
EXECUTE IMMEDIATE 'DELETE USERBATCH.HISTORY_JOB WHERE USER_ID ='''| | p_User_Id | |'''
AND Job_Code ='''| | p_Job_Code | |''' AND PARAMETER_ENTRY = '''| | p_Parameter_Entry | |'''';
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
p_Status := 0;
DBMS_OUTPUT.PUT_LINE( SUBSTR(SQLERRM,1,255) );
END DeleteOld_Job;
TIA
null -
Hi!
I created a dynamically generated tabular form - the number of columns is not known in advanced. Each cell of the form is a text item generated with apex_item.text().
I want to write an after-submit process that saves the values from the form into a database table. In this process I already know how many columns there are in the report so I want to do the following:
--for each row...
for i in 1..apex_application.g_f01.count loop
-- and for each column in that row (number of columns is in v_col_count)
for j in 1..v_col_count loop
-- get the value of text item
v_query := 'select apex_application.g_f0' || j || '(' || i || ')' || ' from dual';
execute immediate v_query into v_value;
-- now do some DML with v_value
end loop;
end loop;The problem is that I get an error: ORA-06553: PLS-221: 'G_Fxx' is not a procedure or is undefined where xx is the number from the generated query.
My question is - am I doing something wrong or is is just not possible to reference apex_application.g_fxx in "execute immediate"? Will I have to manually check for all 50 possibilites of apex_application.g_fxx? Is there another way?
TIA,
JureWell now I know what was wrong and what you were trying to tell me - apex_application.g_fxx is not visible in "plain" SQL. And now I also have a solution to this problem. The point is to wrap the select statement with begin - end block so that the statement is rendered as pl/sql:
--for each row...
for i in 1..apex_application.g_f01.count loop
-- and for each column in that row (number of columns is in v_col_count)
for j in 1..v_col_count loop
-- get the value of text item
v_query := 'begin select apex_application.g_f0' || j || '(:i)' || ' into :x from dual; end;';
execute immediate v_query using i, out v_value;
-- now do some DML with v_value
end loop;
end loop;This works great :).
Jure
Maybe you are looking for
-
Burning an iMovie and Connecting eMacs via Crossover Cables
Is the following solution to my scenario possible: I have a dead Superdrive in one of my eMacs and am unable to burn (obviously). I would still like to use the eMac to create movies using iMovie but am wondering if I can connect this eMac to another
-
Does the Apple mini port to DVI work with a DVI-I monitor?
-
Can I share a Numbers spreadsheet with someone else as a read
I am trying to share a spreadsheet with a collegue ... does anyone know how I can do this?
-
Connecting IPOD video to surround sound HELP PLEASE!
Hi! I have been trying to connect my ipod to my surrond sound system at home, but everytime I plug it in all it says is "Do not disconnect" and won't let me go to my menu to play songs. Any suggestions? Thanks!
-
Hello Experts, I am working on Interface, where i have the data in Internal Table. Now I am required to transfer the internal table data into Comma separated file with extension '.csv' . I used the FM 'SAP_CONVERT_TO_CSV_FORMAT' and provided the de-