ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML;;
Hi all,
I have a problem!
I have one PL SQL function doing an Update and insert into some oracle tables, this function return one number (0 or 1 or 2).
I'm excuting this query from one PHP program to call the function :
SELECT SALE.DB_FUNC_ASSOCIATE_TB2U('[email protected]',123)
FROM dual;
the problem that I have these errors :
ERROR DB_FUNC_ASSOCIATE_TB2U Level 1 : ORA-01403: no data found
ERROR DB_FUNC_ASSOCIATE_TB2U : ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML
there's a mean that i can do to call this function from PHP without getting this Error such as I tested this function using the script below and it works fine:
declare
a number;
begin
a:= SALE.DB_FUNC_ASSOCIATE_TB2U('[email protected]',123) ;
end;
Please help me :)
regards,
Sure, it works in the sense that you would no longer get an error.
Creating this as an autonomous transaction, however, is going to blow your transactional integrity. You've now got code that is being called as the result of a SELECT operation (something that everyone that comes after you will assume is read-only) that commits outside of the current transaction scope. That is almost always a bad thing.
In addition, having a WHEN OTHERS without a RAISE is almost always a bug. You're completely hiding the error message plus you're discarding proper exception handling in order to provide a return code and assuming that the caller is going to check the status. Relying on return status codes is normally a bad idea because it's very easy on the client side to forget to check the return code. Even if the client were to check the return code, it has no idea what went wrong, so it can't even log the root cause of the error.
Justin
Similar Messages
-
ORA-20001: Oracle error -20001: ORA-20001: Oracle error -14552: ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML has been detected in fnd_global.set_nls.set_parameter('NLS_LANGUAGE','AMERICAN'). has been detected in fnd_global.set_nls.
this error generates everytime when i run a apex application
i did call the package in session state with dbms_session.set_nls('NLS_LANGUAGE','AMERICAN'); but still it shows the error in the report any solution pleaseHi Amrit
Can you put the FND_GLOBAL calls in a pre map trigger/process rather than as part of the map?
Cheers
David -
ORA-14552: cannot perform a DDL in a execute immediate - proc
Hi All,
I am trying to disable triggers in a stored procedure:
PROCEDURE Alter_trigger_DISBALE
IS
BEGIN
execute immediate ('alter trigger BEI_INS_MY DISABLE');
END;
I get the following error:
ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML
Is there a solution for this problem ?
Best Regards
FriedholdHow are you calling the procedure?
I assume that, since your procedure actually compiles, it doesn't have the parenthesis around the EXCEUTE IMMEDIATE string and that there is a CREATE before the PROCEDURE. I hope that "disable" is spelled correctly in the real thing.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Calling procedure from RPD. Error ORA-14552 as it has a commit.
Hi All,
I have implemented the calling of procedure functionality from rpd.
But our data base procedure that is called has commit in it which I guess is not allowed & so we are getting this error.
We need to commit once we finish off the procedure. Please suggest how we can achieve this.
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 14552 message: [Oracle][ODBC][Ora]ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML ORA-06512: at "DWH.DWH_PA_TC_ACCRUAL_PKG", line 1565 ORA-14551: cannot perform a DML operation inside a query ORA-06512: at "DWH.TRAILING_COST_FUNCTION", line 8. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
Thanks.
pankajThis is we are using from RPD to call the function:
SELECT trailing_cost_function('USD', 'JUN-08', ' POC', '', 'DJRC46', '') AS RET_VAL
FROM dual
Now this is the structure of the function which is in back end db:
CREATE OR REPLACE Function
Trailing_Cost_Function(a IN varchar2,b IN varchar2,c IN varchar2,d IN varchar2,e IN varchar2,
f IN varchar2) return
varchar2 IS
ret_o varchar2(50);
begin
test123; -- calling the procedure
ret_o:='0';
return ret_o;
end;
And the procedure is:
create or replace procedure test123 is
begin
insert into test_123 values ('asssd');
end test123;
Thanks,
Pankaj -
ORA-14551: cannot perform a DML operation inside a query
I have a Java method which is deployed as a Oracle function.
This Java method parses a huge XML & populates this data
into a set of database tables.
I have to call this Oracle function in a unix shell script using sqlplus.
Value returned by this function will be used by the shell script to decide
what to do next.
I am calling the Oracle Java function as follows in the shell script:
echo "SELECT XML_TABLES.RUN_XML_LOADER('$P1','$P2','$P3','$P4') FROM DUAL;\n" | sqlplus $DB_USER > $LOG
This gives error - "ORA-14551: cannot perform a DML operation inside a query".
If I have to add a AUTONOMOUS_TRANSACTION pragma to this Java function,
where to I add it considering, that the definition of the function is in a Java class.
Can we do it in call spec?
create or replace package XML_TABLES is
function RUN_XML_LOADER(xmlFile IN VARCHAR2,
xmlType IN VARCHAR2,
outputDir IN VARCHAR2,
logFileDir IN VARCHAR2) RETURN VARCHAR2 AS
LANGUAGE JAVA NAME 'XmlLoader.run
(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
return java.lang.String';
end XML_TABLES;
If not is there any other way to acheive this?
Thanks in advance.
Sunitha.If I have to add a AUTONOMOUS_TRANSACTION pragma to this Java function,You'd have to write a PL/SQL function that calls the JSP. But I would caution you about using that pragma. It does introduce tremendous complexity into processing.
As I see it you only need a function to return the result code so why not use a procedure with an OUT parameter?
Cheers, APC
Of course Yoann's suggestion of using an anonymous block would work too.
Message was edited by:
APC -
Getting error SQL Error : ORA-14551: cannot perform a DML operation inside a query
Hi gurus ,
Your help is greatly appreciated ..
I am doing some changes in the fucntion for an existing package .Introducing the new below check , am updating one of the tables based on a if condition ..
IF numALLOWED_COUNT >= numLAST_COUNT_ADDED+1 THEN
blnGDS_Allowed :=True;
varSTMT := 'UPDATE PROD.TMS_PROCESS_COUNTER ';
varSTMT := varSTMT ||' SET last_count_added = last_count_added+1';
varSTMT := varSTMT ||' WHERE process_name = ''DAILY_GDS_COUNT''';
varSTMT := varSTMT ||' AND COUNTER_IND = ''750FD130''';
PROC_LOG('Update Tms_Process_counter varSTMT --' || varSTMT);
IF INSERT_BATCH(99,varSTMT) > 0 THEN
NULL;
END IF;
Function for insert_batch :
UNCTION INSERT_BATCH(numTABLE_ID IN NUMBER, varSQL_STATEMENT IN VARCHAR2) RETURN NUMBER IS
varINSERT_BATCH_STMT VARCHAR2(32767) := NULL;
varADD_REC_TYPE BATCH_TABLES.ADD_REC_TYPE%TYPE;
BEGIN
PROC_LOG( 'INSIDE INSERT_BATCH IRC : ' || varSQL_STATEMENT ); --IRC 9/20 UC
INSERT INTO BATCH_STATEMENT(QUEUE_ID,TABLE_ID,STATEMENT,QUEUE_SEQUENCE_ID)
VALUES (numQUEUE_ID,numTABLE_ID,varSQL_STATEMENT,1);
RETURN 1;
EXCEPTION WHEN OTHERS THEN
PROC_LOG('Failed in INSERT_BATCH');
PROC_LOG('SQL Error : ' || SUBSTR(SQLERRM,1,1000));
RETURN -1;
END INSERT_BATCH;
desc PROD.BATCH_STATEMENT
QUEUE_ID NUMBER(15) NOT NULL
TABLE_ID NUMBER(2) NOT NULL
STATEMENT VARCHAR2(4000 BYTE) NOT NULL
QUEUE_SEQUENCE_ID NUMBER(5) NOT NULL
Some how when its calling the insert_batch , its giving me the error in the logs as below:
04:01:41 - Update Tms_Process_counter varSTMT --UPDATE PROD.TMS_PROCESS_COUNTER SET last_count_added = last_count_added+1 WHERE process_name = 'DAILY_GDS_COUNT' AND COUNTER_IND = '750FD130'
04:01:41 - INSIDE INSERT_BATCH IRC : UPDATE PROD.TMS_PROCESS_COUNTER SET last_count_added = last_count_added+1 WHERE process_name = 'DAILY_GDS_COUNT' AND COUNTER_IND = '750FD130'
04:01:41 - Failed in INSERT_BATCH
04:01:41 - SQL Error : ORA-14551: cannot perform a DML operation inside a querySome how when its calling the insert_batch , its giving me the error in the logs as below:
04:01:41 - SQL Error : ORA-14551: cannot perform a DML operation inside a query
Yes - and the exception is telling you EXACTLY what the problem is. You have a query
IF INSERT_BATCH(99,varSTMT) > 0 THEN
And you are performing a DML operation inside that query:
INSERT INTO BATCH_STATEMENT(QUEUE_ID,TABLE_ID,STATEMENT,QUEUE_SEQUENCE_ID)
VALUES (numQUEUE_ID,numTABLE_ID,varSQL_STATEMENT,1);
Like the exception says: you can't do that.
You need to call the function using PL/SQL and capture the return value into a variable. Then test that variable:
myVar := INSERT_BATCH(99,varSTMT);
if myVar > 0 THEN -
Cannot perform DDL DML inside a query
Hi,
I am using Tom Kyte's in_list function to create a select list inside a select query in one of the reports in my application, given as follows:
SELECT col1, col2,...htmldb_item.select_list_from_query(1,NULL,
'(SELECT column_value d,column_value r FROM the((SELECT CAST
(mypackage.in_list(''||colon_delimited_list||'') AS
myTableType) FROM dual) ))' )...FROM A, B WHERE ...
But the following error appears:
report error:
ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML
ORA-06512: at "FLOWS_020200.WWV_FLOW", line 7002
ORA-06512: at "FLOWS_020200.WWV_FLOW_UTILITIES", line 113
ORA-06550: line 1, column 45:
PLS-00103: Encountered the symbol "(" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with
If I replace the query passed to function select_list_from_query, with some simple dummy query, then it works fine.
Please tell me is there any limitation of its use as this case?
What may be the possible best solution?
Regards,
Amir AmanI have tried Scott's parenthesis solution first.
It is working but with making an additional change, i.e., passing '||''''||colon_delimited_list||''''||' instead just ''||colon_delimited_list||''.
Denes, I have also seen your examples, really a helpful resource.
Thank you very much!
Amir Aman -
Hello,
I have an Oracle 10.2.0.1 database and access via sqlplus, toad or applications that use ado for example, is shown the errors ORA-00604-(recursive sql error ocurred at level 1) and ORA-14552 - (can not perform DDL, commit or rolback inside a query or DML) simultaneously. The interesting thing is that is causing intermittent access occurs sometimes but not others. Already checked all datafiles and tablespace structure, but did not identify the source of these errors. These errors occur in access to different schemas, as if the source was some bug or global parameter. What could be causing this?
Thanks.Would any query in the data dictionary that I could use for self-identifying the source of these errors? In my environment at times though I was logged on the bench when I run some queries it returns the error. It's been two days and am having difficulty self-identifying the problem. Another thing that I could enter the problem is that one of the developers of the application created and modified objects in production base without us knowing. He told us that despite the change there is nothing that could cause errors. We are thinking of stopping the database and start again. This would also be an alternative?
-
Cannot perform DML inside a query
Hi,
I have a Function and I am trying to execute an "Insert" statement into the Function. It gives me an error saying that-
ERROR:
ORA-14551: cannot perform a DML operation inside a query
ORA-06512: at "SCOTT.POP3", line 243
I then tried adding : PRAGMA AUTONOMOUS_TRANSACTION to the Function and then it gives me an error saying-
ERROR:
ORA-06519: active autonomous transaction detected and rolled back
ORA-06512: at "SCOTT.POP3", line 245
My code snippet is as follows :
CREATE OR REPLACE FUNCTION pop3 (
username VARCHAR2,
PASSWORD VARCHAR2,
msgnum NUMBER
RETURN tstrings PIPELINED
IS
--PRAGMA AUTONOMOUS_TRANSACTION;
pop3_server CONSTANT VARCHAR2 (100) := 'pop.secureserver.net';
pop3_port CONSTANT NUMBER := 110;
pop3_ok CONSTANT VARCHAR2 (10) := '+OK';
e_pop3_error EXCEPTION;
socket UTL_TCP.connection;
line VARCHAR2 (30000);
line2 VARCHAR2 (30000);
BYTES INTEGER;
msg_from varchar2(4000) := '';
msg_to varchar2(4000) := '';
msg_date varchar2(4000) := '';
msg_sub varchar2(4000) := '';
msg_body clob := NULL;
hyphen_checker number := 0;
msg_body_flag number := 0;
crlf varchar2(2) := chr(13) || chr(10);
-- send a POP3 command
-- (we expect each command to respond with a +OK)
FUNCTION writetopop (command VARCHAR2)
RETURN VARCHAR2
IS
len INTEGER;
resp VARCHAR2 (30000);
BEGIN
len := UTL_TCP.write_line (socket, command);
UTL_TCP.FLUSH (socket);
-- using a hack to check the popd response
len := UTL_TCP.read_line (socket, resp);
IF SUBSTR (resp, 1, 3) != pop3_ok
THEN
RAISE e_pop3_error;
END IF;
RETURN (resp);
END;
BEGIN
DBMS_LOB.CREATETEMPORARY(msg_body,true);
PIPE ROW ('pop3:' || pop3_server || ' port:' || pop3_port);
-- Just to make sure there are no previously opened connections
UTL_TCP.close_all_connections;
-- open a socket connection to the POP3 server
socket :=
UTL_TCP.open_connection (remote_host => pop3_server,
remote_port => pop3_port,
--tx_timeout => POP3_TIMEOUT,
CHARSET => 'US7ASCII'
-- read the server banner/response from the pop3 daemon
PIPE ROW (UTL_TCP.get_line (socket));
-- authenticate with the POP3 server using the USER and PASS commands
LOOP
EXIT WHEN LENGTH (line) = 1 AND line = '.';
END LOOP;
INSERT INTO email (em_issue, em_date, em_from, em_to, em_subject, em_body)
VALUES(seq_issue.nextval, msg_date, msg_from, msg_to, msg_sub, msg_body);
DBMS_LOB.freetemporary(msg_body);
msg_from := '';
msg_to := '';
msg_date := '';
msg_sub := '';
msg_body := NULL;
-- close connection
PIPE ROW ('QUIT');
PIPE ROW (writetopop ('QUIT'));
UTL_TCP.close_connection (socket);
EXCEPTION
WHEN e_pop3_error
THEN
PIPE ROW ('There are no mails !');
END;
Message was edited by:
Monk
Message was edited by:
MonkSee Note:313597.1 on MetaLink
-
Probelm regarding function ( can not perform dml openration inside a query
hi all,
i have created on function which is used for delete rows and insert new rows ( records) but when i run i got
ora-14551 -can not perform a DML operation inside a query
0ra-06512 - fn_brok_upfdate_dtltbl , line no 21
this error
following are my code please help me
CREATE OR REPLACE FUNCTION Fn_Brok_Update_Dtltbl
(fnBROK_TYPE VARCHAR2,fnSLAB_ID VARCHAR2, fnINV_TYPE_CODE VARCHAR2)
RETURN NUMBER
AS
fnCOUNT PLS_INTEGER;
fnTBLNAME VARCHAR2(40);
fnTMPINV_TYPE_CODE VARCHAR2(1000);
fnTMPINVCODE VARCHAR2(50);
fnMYQUERY VARCHAR2(4000);
BEGIN
IF UPPER(fnBROK_TYPE) = 'UPFRONT' THEN
fnTBLNAME :='UPFRONT_RECD_DTL';
END IF ;
IF fnSLAB_ID IS NOT NULL AND fnINV_TYPE_CODE IS NOT NULL THEN
fnTMPINV_TYPE_CODE := fnINV_TYPE_CODE ;
fnMYQUERY := 'SELECT COUNT(*) FROM '||fnTBLNAME||' WHERE SLAB_ID = '''||fnSLAB_ID||'''' ;
EXECUTE IMMEDIATE fnMYQUERY INTO fnCOUNT ;
IF fnCOUNT > 0 THEN
DELETE FROM UPFRONT_RECD_DTL WHERE slab_id = fnslab_id ;
END IF ;
WHILE fnTMPINV_TYPE_CODE IS NOT NULL
LOOP
SELECT CASE WHEN INSTR(fnTMPINV_TYPE_CODE,',')= 0 THEN fnTMPINV_TYPE_CODE
ELSE Strsplit(fnTMPINV_TYPE_CODE,1,INSTR(fnTMPINV_TYPE_CODE,',') - 1 ) END INTO fnTMPINVCODE FROM DUAL ;
fnMYQUERY := 'INSERT INTO '||fnTBLNAME||'(SLAB_ID, INV_TYPE_CODE)
VALUES ('''||fnSLAB_ID||''','||fnTMPINVCODE||') ' ;
EXECUTE IMMEDIATE fnMYQUERY ;
SELECT CASE WHEN INSTR(fnTMPINV_TYPE_CODE,',')= 0 THEN NULL
ELSE Strsplit(fnTMPINV_TYPE_CODE,INSTR(fnTMPINV_TYPE_CODE,',')+ 1 , LENGTH(fnTMPINV_TYPE_CODE)) END
INTO fnTMPINV_TYPE_CODE FROM DUAL ;
END LOOP ;
fnCOUNT := 1 ;
RETURN fnCOUNT ;
END IF ;
END ;
[\pre]How did you call this function ? from SQL Statement ? Then No way .. . .
ORA-14551: cannot perform a DML operation inside a query
Cause: DML operation like insert, update, delete or select-for-update cannot be performed inside a query or under a PDML slave.
Action: Ensure that the offending DML operation is not performed or use an autonomous transaction to perform the DML operation within the query or PDML slave -
SQL Error: ORA-04092: cannot COMMIT in a trigger
Trying to drop the table inside the trigger but i'm unable to do it.
SQL Error: ORA-04092: cannot COMMIT in a trigger
I need to drop the table based on the some condition say condition is the archive table with more than millions of records which is of no use so i plan to drop the table.
I will be inserting the the unwanted table to mytable ,mytable which is having the trigger will fire to drop the table.
I need this to be done on automatic basis so i have chosen trigger.
is there anyway of automatic other than trigger in this case.933663 wrote:
Trying to drop the table inside the trigger but i'm unable to do it.
SQL Error: ORA-04092: cannot COMMIT in a trigger
I need to drop the table based on the some condition say condition is the archive table with more than millions of records which is of no use so i plan to drop the table.
I will be inserting the the unwanted table to mytable ,mytable which is having the trigger will fire to drop the table.
I need this to be done on automatic basis so i have chosen trigger.
is there anyway of automatic other than trigger in this case.You can't COMMIT inside a trigger. Oracle issue an auto COMMIT before and after the execution of DDL. So you can't use DDL in trigger. You may get suggestion to use AUTONOMOUS_TRANSACTION to perform COMMIT within tirgger. But dont do that. Its wrong idea.
I will suggest you look back into your requirement and see what exactly you want. You could schedule a job that runs on a daily basis that will pick up the object details from your table and drop them accordingly. -
ORA-02047: cannot join the distributed transaction in progress
Hi All,
My requirement is to do COMMIT Transactions in BULK like 100 rows. I am doing update in Oracle and SQL Server both. Following statement update the SQL Server side:
v_sqlstr :=
'update JDETAIL set interfacedate = getdate() where company ='
|| v_company
|| ' and Recordnumber= '
|| TO_NUMBER (v_recordNumber)
|| ' COMMIT TRANSACTION';
num_rows :=
DBMS_HS_PASSTHROUGH.execute_immediate@ex_test (v_sqlstr);
After this I am calling Oracle Update Procedure . In Oracle UPDATE Procedure when I write AUTONOMOUS TRANSACTIONS AND Commit then it works fine BUT when I don't COMMIT which I don't want because I want to COMMIT in BATCHES then following error is thrown
ORA-02047: cannot join the distributed transaction in progress
Thanksyou can't put the commit transaction into a pasthrough statement.
Oracle Gateway starts the transaction, so you need to write the code in a way that allows the gateway to perform the commit. When doing a commit in a passhrough statement the gateway has no control over the committed data. Thus you get the error unless you start an autonomous transaction.
Why do you need to call the update in a pasthrough statement? Why not in a PL/SQl code block with a counter that commits after 100 rows? -
Hi all, I am maintaining a web site that has lots of requests ( about 10 requests a second ) to an Oracle table that has a BLOB field. Those requests create new blobs, updates them and reads them... My program worked fine until I started using connection pooling ( Before that, I used a single connection that was initialized at startup ). Although I had to synchronized the methods that interact with blob field, everything worked great. So now, to optimize my site, I want to use connection pooling so that even if my methods are synchonized on the connection object, there will be more than one connection available so it will not affect performance.
So once I introduced my connection pooling system with the oracle.jdbc.pool.OracleConnectionCacheImpl class, I started getting ORA-22990 ( Cannot span lob objects... ). I get the error on the flush() method when I try to write the blob to the database. Here is my function that writes a row in the databse.
private synchronized void writeSession(CapSession pSession) throws Exception
javax.sql.PooledConnection pc = pool.getPooledConnection();
Connection conn = pc.getConnection();
CallableStatement stmt=conn.prepareCall(writeObjSQL);
stmt.setString(1,pSession.getSessionId()+pSession.getPassword());
stmt.setLong(2,pSession.getLastAccess());
stmt.setLong(3,pSession.getTimeout());
stmt.registerOutParameter(4,java.sql.Types.BLOB);
stmt.executeUpdate();
oracle.sql.BLOB blob=(BLOB)stmt.getBlob(4);
OutputStream os=blob.getBinaryOutputStream();
ObjectOutputStream oop=new ObjectOutputStream(os);
oop.writeObject(pSession);
oop.flush();
oop.close();
os.close();
stmt.close();
conn.commit();
conn.close();
pc.close();
} If anyone could help me, I would deeply appreciate it!
Thank you for your time.kalle
Thank you very much for your advice!!!
Like you said, I started to check whether the connections are fine before giving them from the pool.I am executing a simple "select 'anil' from dual" and if its fine only then I return the connection. So far it seems to be fine. Also I am reopening the connections(closing the old ones and opening new connections) after every 12 hours.
As far as the JDBC driver is concerned, I already tried with Oracle 8i driver, it gave the same problems. I read that 9i driver might solve this problem, so I changed to the latest 9i driver (classes12_g.zip).
Sometimes before(before I started checking whether the connection is good )the application used to hang up at the point where I am issuing setAutoCommit(false).It never comes out from that statement.Is this something to do with theconnections being closed?
What I am afraid is, will the appilation get hung up even after I check the connection with select query and then issue autocommit(false)??
Or will it hang up while I check with a select query??
As long as it doesn't hung up, I am fine. Because i am cathching the exceptions.
Thanks In ADVANCE
Anil -
ORA-00604 & ORA-30512 CANNOT MODIFY TABLE MORE THAN ONCE IN A TRANSACTION
We have a requirement where two tables should be in sync at any given point
in time with respect to the structure of the tables.
Any change on table/column via ALTER (MODIFY, ADD, RENAME COLUMN, DROP
COLUMN) on the parent table should be replicated to the replica table.
I created a DDL_TRIGGER on the schema and the desired result is achieved but
for the following one scenario for which its failing.
The issue is, if we try to reduce the width of the column (via ALTER ..
MODIFY) it fails with the following error
ORA-00604: error occurred at recursive SQL level 1
ORA-30512: cannot modify DEVTESTF_OIM.REPLICA_ABC more than once in a
transaction
Please follow the steps to reproduce the issue (the issue is across the DB
version checked on 10.2, 11.1 and 11.2 DB version)
-- Step1 Create Parent Table
CREATE TABLE abc (col1 VARCHAR2(10))
-- Step2 Create Replica Table
CREATE TABLE replica_abc (col1 VARCHAR2(10))
-- Step3 Create DDL Trigger
CREATE OR REPLACE TRIGGER ddl_trigger
AFTER ALTER ON SCHEMA
DECLARE
operation VARCHAR2(30);
object_name VARCHAR2(30);
l_sqltext VARCHAR2(100);
i PLS_INTEGER;
l_count NUMBER:=0;
sql_text dbms_standard.ora_name_list_t;
BEGIN
i := dbms_standard.sql_txt(sql_text);
SELECT ora_sysevent, ora_dict_obj_name, UPPER(sql_text(i))
INTO operation, object_name, l_sqltext
FROM dual;
IF ora_dict_obj_name = 'ABC' THEN
l_count := INSTR(l_sqltext,'ADD CONSTRAINT',1,1);
l_count := l_count + INSTR(l_sqltext,'DISABLE',1,1);
l_count := l_count + INSTR(l_sqltext,'DROP CONSTRAINT',1,1);
l_count := l_count + INSTR(l_sqltext,'PRIMARY KEY',1,1);
l_count := l_count + INSTR(l_sqltext,'ADD CHECK',1,1);
IF (l_count = 0) THEN
l_count := INSTR(l_sqltext,'ADD',1,1);
l_count := l_count + INSTR(l_sqltext,'MODIFY',1,1);
l_count := l_count + INSTR(l_sqltext,'DROP COLUMN',1,1);
l_count := l_count + INSTR(l_sqltext,'RENAME
COLUMN',1,1);
IF (l_count >0) THEN
l_sqltext := REPLACE(l_sqltext,'TABLE ABC','TABLE REPLICA_ABC');
execute immediate l_sqltext;
END IF;
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
RAISE ;
END;
-- Step 4 Issue the following ALTER command on the Parent table 'ABC'
ALTER TABLE ABC MODIFY COL1 VARCHAR2(9);
will show the following
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-30512: cannot modify DEVTESTF_OIM.REPLICA_ABC more than once in a
transaction
ORA-06512: at line 34
whereas the following commands works fine
ALTER TABLE ABC MODIFY COL1 VARCHAR2(11);
and also the rest of the operations
ALTER TABLE ABC ADD COL2 VARCHAR2(20);
ALTER TABLE ABC RENAME COLUMN COL2 TO COL3;
ALTER TABLE ABC DROP COLUMN COL3;
The issue is while reducing the size of VARCHAR2 columns, while the rest of
option works fine.
Any suggestion or workaround please.It looks like a bug to me. The failing statement from the SQL trace is
PARSE ERROR #12:len=77 dep=3 uid=0 oct=3 lid=0 tim=1263332549608656 err=30512
select /*+ first_rows */ 1 from "TIM"."REPLICA_ABC" where LENGTHB("COL1") > 9and exception cannot explain it. -
What causes "ORA-01445: cannot select ROWID from" error
While executing a SELECT query i got this error:
ORA-01445: cannot select ROWID from, or sample, a join view without a
key-preserved table
Below mentioned is the join condition part of the query. The line which the error has occured is italicized
from checkout_hdtl ch
inner join pmt_htl ph on ph.post_ln_a = ch.post_ln_code
inner join pin_dls pd on pd.post_ln_a = ph.post_ln_code
inner join carton_dtl cd on cd.carton_nbr = ch.carton_nbr
and cd.lseq_nbr = pd.lseq_nbr
inner join invoice_module im on cd.invevt_code = im.inv_code
inner join item_dock_master del on nm.invent_code = iwm.inv_code
left outer join inv_curr_comm_code mnb on ium.invent_code = im.inv_code
and icc.cntry = ph.shipto_cntry
left outer join vw_ver_master vw on vw.del_rec = ch.del_rec
left outer join cmd code_entry on code_pi.cntry =
cd.code_entry where ch.shpmt_nbr = '3'
What do i do?I would rather use Notepad than store my data in SQL server. It just so happens that our product is released for SQL Server as well. Hence i did the testing.
>Is there a limit to the number of joins that can be performed in Oracle?
Wrong question as it does not have anything to do with the number of views.. it has everything to do with the ability to correctly identify the unique row. Re-read the error message details posted by Blu - it explains the error.As you can see from my post, i created a table using the(CTAS) SELECT query from the View vw_ver_master's definition. So the view's result set is now stored in a table and now there are only tables involved in these JOINS.
The query will succeed if i comment out ANY one of these JOINS in this statement. This is so weird.
I
Maybe you are looking for
-
Form problem, Please Help
I have a Form that contains multiple texxt boxes from a table, i also have a LOV on one various text boxes that queries other tables to give back a value. On the choosing of a value the ID that represents that value populates the text box. As this re
-
FCP X Animated Titles Error - Help!
My OSX is 10.6.8, FCP X 10.0.7 I am working on a trianing project for the last few months. It was working fine until i installed a software patch for FCPX which came through the apple software update. (well this is my assumption and i am not an exper
-
Add page break when exporting a report as an editable RTF with JRC
Hello, When exporting a report as an editable rtf in Crystal Reports Designer we can select the option : "Insert page break after each report page". Does the same option exists in the JRC ? I don't want to use the MSWord export format. Thanks in adva
-
Question about SRW.DO_SQL
This is my problem.. I cannot insert a record when I run the report. I used the before report trigger. Please help. What do you think is the problem? Thanks. Really appreciate all the help. function BeforeReport return boolean is begin srw.do_sql('CR
-
Shouldn't this work? dd command issues.
I'm hoping to bring together a hodge podge of old parts lying about into a sweet smoking Arch machine. I've got everything I need, except what I thought would be the easiest part of the whole box... a usable hard disk. After finding two reasonably ne