How to handle Ora-06512
Hi,
I am using raise_application_error(code,message)
for customized exception messages. I am getting it correctly. but with that message I am also getting Ora-06512 , why it is coming there ?
E.g.
EXEC PKG_PRODADJORDERS.PROC_CREATEORDER(200304,2,7,'CHBB01','0','AD1','01-APR-2004','R');
ERROR at line 1:
ORA-20007: Error : Mapping item not maintained for current Item.
ORA-06512: at "SBUL.PKG_PRODADJORDERS", line 108
ORA-06512: at line 1
here Ora-20007 is my message but Oracle is also giving Ora-06512.
What can be the cause ?
Adinath Kamode
ORA-06512 just indicates that there is a stack trace. Oracle will provide the error message and then indicate where the error was thrown to aid in debugging.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Similar Messages
-
How to handle ORA-28001 error with JDBC thin driver ?
Dear reader,
As you all know, ORACLE returns error ORA-28001 upon a connection attempt when the user's password has expired.
Handling the error in OCI is quite simple, thanks to the function OCIPasswordChange(). However, I have not been able to find a JAVA equivalent in the Oracle JDBC library.
I have found a field called oracle.jdbc.driver.OracleDriver.set_new_password_string, and a field oracle.jdbc.OracleConnection.CONNECTION_PROPERTY_SET_NEW_PASSWORD, but I have really no idea on how to use them (if appropriate) so as to allow the user to change his/her password on the fly.
I greatly appreciate having any advice from anyone who happened to be faced with that problem.
Best regards.
Georges BREFORTHi,
according to Note [124970.1 Example: How to Change an Expired Password in JDBC?|https://metalink2.oracle.com/metalink/plsql/f?p=130:14:2181952130729466734::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,124970.1,1,1,1,helvetica] it's possible with JDBC Thick (OCI) driver only. -
Re: How to Handle ORA Errors in adf
HI all.
I am using Jdev 11.1.2.3 , Database oracle 11g,
Some scenarios i am getting ORA:022XXX error popup.
How can i make this popups as user defined messages.
Withregards,
satishkumar NHi Satish,
To my mind the easiest solution would be one from developer's guide (last option Lars suggested). But it is quite limited, because there You can't override ORA messages like ORA:022XXX in general, there You must list specific DB constraints in two-dimensional array. In this solution I also missed just simple "error code -message" mapping in regular bundle file. It is not described in developer's guide, but easily implemented by just creating bundle file in the same package as extending class resides (more details in blog post Custom bundle to override default error mesasges in ADF application).
But.. If You still need to override DB messages like ORA:022XXX, not particular constraints, You should go with rth suggested solution.
Here is a code sample of "DCErrorHandlerImpl" extending class to set You on the road:
public class DataControlExceptionHandler extends DCErrorHandlerImpl {
public DataControlExceptionHandler() {
super(true);
@Override
public String getDisplayMessage(BindingContext bindingContext, Exception exception) {
if (exception instanceof SQLIntegrityConstraintViolationException) {
SQLIntegrityConstraintViolationException sqlExc = (SQLIntegrityConstraintViolationException) exception;
return "DB exception occured: "+ sqlExc.getMesage();
return exception.getLocalizedMessage();
Regards,
Danas -
How to handle ORA-00942: table or view does not exist
Hii All,
I'm trying to drop a table dynamically irrespective of its existence in a procedure. Its working fine when table exists but when table doesn't exist I'm facing following error
ORA-00942: table or view does not existI made use of pragma exception_init and modified my code as below
Create or replace Procedure sp_FSASA_FEEDUPLOAD_process
p_test_dir in varchar2,
p_feed_file_name in varchar2
is
l_exttable_str varchar2(32000) ;
l_log_file constant varchar2(200) := 'logfile_rgh.log';
l_table_doesnt_exist Exception;
pragma exception_init(l_table_doesnt_exist,-00492);
Begin
Begin
execute immediate 'drop table FSASA_FEEDUPLOAD_EXT purge' ;
Exception
when l_table_doesnt_exist then
null;
End;
l_exttable_str := 'Create table FSASA_FEEDUPLOAD_EXT ';
l_exttable_str := l_exttable_str||' ( ';
l_exttable_str := l_exttable_str||' Category_No varchar2(1), ';
l_exttable_str := l_exttable_str||' Financial_Category varchar2(300), ';
l_exttable_str := l_exttable_str||' GFCID number, ';
l_exttable_str := l_exttable_str||' Balance number(34,14), ';
l_exttable_str := l_exttable_str||' Refernce_no varchar2(20), ';
l_exttable_str := l_exttable_str||' Account_no varchar2(20), ';
l_exttable_str := l_exttable_str||' ce_trans_id varchar2(20) ';
l_exttable_str := l_exttable_str||' ) ';
l_exttable_str := l_exttable_str||' Organization external ';
l_exttable_str := l_exttable_str||' ( ';
l_exttable_str := l_exttable_str||' type oracle_loader ';
l_exttable_str := l_exttable_str||' default directory '||p_test_dir;
l_exttable_str := l_exttable_str||' Access parameters ';
l_exttable_str := l_exttable_str||' ( ';
l_exttable_str := l_exttable_str||' records delimited by newline ';
l_exttable_str := l_exttable_str||'BADFILE '||q'[']'||p_test_dir||q'[']'||':'||q'[']'||'feed.bad '||q'[']' ;
l_exttable_str := l_exttable_str||'LOGFILE '||q'[']'||p_test_dir||q'[']'||':'||q'[']'||':feed.log '||q'[']' ;
l_exttable_str := l_exttable_str||q'[FIELDS TERMINATED BY X'09']';
l_exttable_str := l_exttable_str||' missing field values are null ';
l_exttable_str := l_exttable_str||')location('||q'[']'||p_feed_file_name||q'[']';
l_exttable_str := l_exttable_str||')' ;
l_exttable_str := l_exttable_str||' )Reject limit unlimited ';
dbg_print(l_log_file,'l_exttable_str : '||l_exttable_str);
execute immediate l_exttable_str;
End;But still I'm unable to get rid of it. Pls help me.
1)I need to drop it as I need to immediately create table with different file name and from different path.
2)The last thing I don't like to do is to check the table name in USER_OBJECTS and then drop.
3)Also suggest me whether creating an external table dynamically is correct approach or not.
4)Till now we were using utl_file for reading feed file but I'm much interested in using EXTERNAL TABLE concept.
5)As the filename and path gets changed I need to create my external table at runtime.
please suggest me whether I can alter my filename and path at runtimeYou will need to use WHEN OTHERS EXCEPTION handler which is not a good idea to do so if you dont handle the same approprialtly then the exception would go un-noticed:
SQL> ed
Wrote file afiedt.buf
1 begin
2 execute immediate 'drop table my_Test';
3 exception
4 when others then
5 dbms_output.put_line(SQLCODE||SQLERRM);
6* end;
SQL> /
-942ORA-00942: table or view does not exist
PL/SQL procedure successfully completed.
SQL> -
I'm getting ORA-04030: out of process memory when trying to allocate 1024
bytes (callheap,RPI allocations) ,when i try to fech from a table and load it to another table.
I have written a PL/SQL script for this.
The table from which i'm gng to load is having millions of record.In my script ,i'm using BULK FETCH to fetch from the table and using FORALL to make Bulk Insert.
Here,i limit the Fetch by Commit Count = 20000.
After Inserting certain amount of record,i'm getting this error.
currently i'm working on Oracle9i,64 bit.
could you pls tell me what can be done for this issue.
Is there ant Patch files?
Pls suggest me
Thanks in advance
MahalakshmiHi
ORA-04030 are not caused by a small or fragmented shared pool, i.e. it is not an ORA-04031 ;-). As described in the docu:
Cause: Operating system process private memory has been exhausted.
Therefore you have a limit in the process memory (where the PGA is located). If you are working on Unix check the limit with "ulimit". Of course you should also check the collection'ss handling in PL/SQL... in fact 20'000 rows should not be a problem...
Chris -
How to handle ORA-00001: unique constraint in EXCEPTION block?
Hi,
Is there a specific exception thats raised when ORA-00001: unique constraint error occurs?SQL> create table test(id number primary key);
Table created.
SQL> set serverout on
SQL> declare
2 ex exception;
3 pragma exception_init(ex,-1);
4 begin
5 insert into test values(1);
6 exception
7 when ex then
8 dbms_output.put_line('dup');
9 when others then
10 raise;
11 end;
12 /
dup
PL/SQL procedure successfully completed.
<br>
<a href ="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/errors.htm#LNPLS00703">Predefied exceptions </a> -
How to handle ORA-12053: this is not a valid nested materialized view
Hi,
I've been trying to create nested MV's for a while and encountered with this error and not able to find a solution even after spending lot of time on this.
Here is the problem.
--> I've 3 base tables Tab1, Tab2, Tab3, which r not having pk's on them (restriction).
--> Created logs on these tables.
--> Created 1st level MV's with pk's (from different schema - siebel schema) defined as MV10,MV11,MV12 with required columns from each base table. These mv's r made fast/complete refresh ... doesn't matter much as complete refresh is done fast (tried both .. just in case if thatz the reason for my error msg).
CREATE MATERIALIZED VIEW mv10
REFRESH COMPLETE/FAST
WITH ROWID
AS
select
col1
,col2
FROM siebel.Tab1@dblink _name;
--> Created MV logs on MV10,MV11,MV12.
--> Created 2nd level MV (join MV) that is based on MV10,MV11,MV12 having join and filter coniditions ... and this gives the error.
I think i've followd all the rules for nested MV and Fast Refreshable rules, but for some reason not able to make it work. Plz throw some light on this.
Thanks
Srinivas VemuriYou will need to use WHEN OTHERS EXCEPTION handler which is not a good idea to do so if you dont handle the same approprialtly then the exception would go un-noticed:
SQL> ed
Wrote file afiedt.buf
1 begin
2 execute immediate 'drop table my_Test';
3 exception
4 when others then
5 dbms_output.put_line(SQLCODE||SQLERRM);
6* end;
SQL> /
-942ORA-00942: table or view does not exist
PL/SQL procedure successfully completed.
SQL> -
ORA-022887 error during insert operation how to handle properly ...
Hello everyone I got an error during insert operation how to handle it properly ?
SQL statements given below.
INSERT INTO PERSONEL.TRANSLATIONS (TID,SCRIPT_NAME,TAG,TR,EN,LOCAL)
VALUES ((SELECT PERSONEL.SQX_TID.NEXTVAL AS TID FROM DUAL),'TEST_TEST','TEST','TR','EN','LOCAL');
thank youI could not find an error like ORA-022887. What is the exact error you are getting? Do a cut and past of the error here.
Ok the proper error is ORA-02287: sequence number not allowed here
As already said just remove the select and use the sequence directly in the insert.
Edited by: Karthick_Arp on Sep 11, 2009 1:04 AM -
How to handle the plsql error occuring in the exception block
We know how to handle exceptins which occur in BEGIN block.
But am unable to catch the exception in the exception block. Am writing an erroeneous code so that the control will go to exception block and there is also one plsql error, but am unable to handle that error, it's returning the error to the calling environment.
DECLARE
cnt NUMBER(5):=0;
BEGIN
select 'debalina' INTO cnt from dual;
DBMS_OUTPUT.PUT_LINE(to_char(cnt));
EXCEPTION
WHEN invalid_number THEN
DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
cnt:='deba';
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
END;
please suggest me how to catch this exception?Hi,
DECLARE
cnt NUMBER(5):=0;
BEGIN
select 'debalina' INTO cnt from dual;
DBMS_OUTPUT.PUT_LINE(to_char(cnt));
EXCEPTION
WHEN invalid_number THEN
DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
cnt:='deba';
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
END;
First of all your namee exception which you have posted i.e invalid_number itself is wrong.
You need to use named exception VALUE_ERROR for catching the exception in the main block.
SQL> DECLARE
2 cnt NUMBER(5):=0;
3 BEGIN
4 select 'debalina' INTO cnt from dual;
5 DBMS_OUTPUT.PUT_LINE(to_char(cnt));
6 EXCEPTION
7 WHEN Invalid_number THEN
8 DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
9 end;
10 /
DECLARE
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 4
SQL> DECLARE
2 cnt NUMBER(5):=0;
3 BEGIN
4 select 'debalina' INTO cnt from dual;
5 DBMS_OUTPUT.PUT_LINE(to_char(cnt));
6 EXCEPTION
7 WHEN VALUE_ERROR THEN
8 DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
9 end;
10 /
error has occured inside main block
PL/SQL procedure successfully completed.Your doubt regarding catching the exception in exception block, you can execute as below, by nesting a Begin block inside the exception block itself.
SQL> DECLARE
2 cnt NUMBER(35):=0;
3 BEGIN
4 select 'debalina' INTO cnt from dual;
5 DBMS_OUTPUT.PUT_LINE(to_char(cnt));
6 EXCEPTION
7 WHEN Value_error THEN
8 DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
9 Begin
10 cnt:='deba';
11 Exception
12 WHEN OTHERS THEN
13 DBMS_OUTPUT.PUT_LINE('error has occured inside exception block');
14 End;
15 END;
16 /
error has occured inside main block
error has occured inside exception block
PL/SQL procedure successfully completed.Hope your doubt is clear.
Twinkle -
How to handle user defined exception from C#?
Hi:
I have some PL/SQL code that will throw a user defined exception if certain conditions are met. How do I handle user defined exceptions if this procedure/function is being called from C#? C# can handle a normal Oracle SQL error (e.g. ORA-XXXX) because they are defined in the proper class, but how do I get it to know about my user defined exception? Does anyone have any links to examples of doing this?
Thanks.Hi Gaff,
Is there a particular problem you're having doing this? It works as normal for me...
Cheers
Greg
PLSQL
=========
create or replace procedure throwsomething as
begin
raise_application_error(-20001,'kaboom');
end;
ODP
=====
class Program
static void Main(string[] args)
using (OracleConnection con = new OracleConnection())
con.ConnectionString = "user id=scott;password=tiger;data source=orcl";
con.Open();
using (OracleCommand cmd = new OracleCommand())
cmd.CommandText = "begin throwsomething;end;";
cmd.Connection = con;
try
cmd.ExecuteNonQuery();
catch (OracleException oe)
Console.WriteLine("caught " + oe.Message);
OUTPUT
========
caught ORA-20001: kaboom
ORA-06512: at "SCOTT.THROWSOMETHING", line 3
ORA-06512: at line 1 -
Hi:
I am using 11gR1 on Windows Server 2003, and trying to setup XMLDB web services and got ora-31001. I Did :
begin
DBMS_NETWORK_ACL_ADMIN.DROP_ACL('localhost.xml');
dbms_network_acl_admin.create_acl(
acl => 'localhost.xml'
,description => 'ACL for 127.0.0.1'
,principal => 'myname'
,is_grant => true
,privilege => 'connect');
dbms_network_acl_admin.assign_acl('localhost.xml', '127.0.0.1');
end;
And got following errors:
ORA-31001: Invalid resource handle or path name "/sys/acls/localhost.xml"
ORA-06512: at "XDB.DBMS_XDB", line 331
ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 392
ORA-06512: at line 2
It seems to be complaining about the default directory “/sys/acls”. How do I do it in Windows? It does not help even if I created a "c:\sys\acls"
Thanks in advnace for your help,
RichardThe security structure /issue it was refering too ("/sys/acls/localhost.xml") is not outside the database. It refers to the XDB repository WebDAV resource structures IN the database (so not on OS or otherwise) which are protected via access control lists. Also you need a database user / the database privileges to create and alter ACL settings. Those ACL's ACE's etc themself are stored in an XML file (your dealing with XMLDB, so what else ;-) ).
-
hi,
i made a trigger on a table fire on after insertion but i m having these error so plz try to solve it.
CREATE OR REPLACE TRIGGER TG1
AFTER INSERT
ON MASTER
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
COUNT NUMBER;
BEGIN
SELECT COUNT(*) INTO COUNT FROM MASTER
WHERE P_ID =:NEW.P_ID ;
BEGIN
IF COUNT=1 THEN
UPDATE MASTER SET PCODE =:COUNT;
END IF;
IF COUNT=2 THEN
UPDATE MASTER SET PCODE =:COUNT+1;
END IF;
END;
END;
ORA-04091: table master is mutating, trigger/function may
not see it
ORA-06512: at "TG1", line 5
ORA-04088: error during execution of trigger 'TG1'You don't understand mutating tables and how to avoid them. Nor do you understand how multi-user systems work. Finally you appear not to understand how to use the documentation Given all that, your soubriquet is overambitious. You might want to consider a more modest handle.
As for the specifics, how to avoid the ORA-4091 error, the root cause is that we cannot select on the table in question in a FOR EACH ROW trigger. You seem to be after an incremental count, presumably as unique identifier. This is the wrong approach: use a sequence and stop worrying about gaps.
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
How to handle Database's trigger
Greetings,
i have an application on JDeveloper 11.1.2.4.0. At some point the user add new customer and its been saved to the database.
Because the application may be used in more than 1 shop, i have created a 2nd database, only for biography uses and history,
so it can be view by all shops. What i did is, when a new record is inserted into application's biography table, i also have a trigger
that after the row is inserted, i also insert the new row into my 2nd database. In both databases a primary key exists to avoid duplicated id's.
I was hoping instead of handling duplicated records on trigger, the database will handle it (if duplicated records exists, just dont save it at all),
but my problem now is, its throw me a proper exception
ORA-00001: unique constraint (PERSONAL_RECORD.BIOGR_PK) violated ORA-06512: at "ELAB.SAVE_BIOGR", line 11 ORA-04088: error during execution of trigger 'ELAB.SAVE_BIOGR' ORA-06512: at line 1
AND it does not save the biogr on the 1st database either. I do not understand what the trigger have to do with the first database since its after insert row method and not before.
It should insert the record into the database, then fire the trigger, throw an exception and dont save the record in 2nd database. But instead the record its been saved nowhere..
The case is: user fields some text boxes for a new customer, i check if the id is already exists in the 2nd database, and i notify the user that this new customer already exists in
the personal record database (2nd database, 1 common database for all shops), and i ask the user if he/she wants to synchronize or use the current fields. If synchronize, i take the record
from the 2nd database and insert them into the 1st. If not, i insert them into the 1st database, and thats when the trigger should handle the duplicate row exception, not my application.
Is there a way i can temporally turn off database trigger from my adf application or i can handle the exception BUT the record be save on the 1st database? because if the exception its been
thrown, the new record its gone.
thanks in advance for any help.True, since i can't handle the trigger procedure, i add an exception inside of it. So it will do something when the exception occurs BUT it will save the customer
in 1st database. Here is my trigger code:
create or replace TRIGGER SAVE_BIOGR
AFTER INSERT
ON ELAB.BIOGR
FOR EACH ROW
DECLARE
v_username varchar2(10);
BEGIN
SELECT user INTO v_username
FROM dual;
INSERT INTO PERSONAL_RECORD.BIOGR
( ID,
NAME,
SNAME,
USERNAME )
VALUES
( :NEW.ID_PATIENTS,
:NEW.NAME,
:NEW.SNAME,
v_username);
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
UPDATE PERSONAL_RECORD.BIOGR SET ERROR = 'ALREADY EXIST';
END;
I add update on exception because leaving it blank or with comment in THEN section it gave me an error i dont know why. So i just
include a dump update procedure. -
hi
I am getting the following error while calling the procedure in the batch process
ORA-06512: at "SYS.UTL_HTTP", line 1022
ORA-29270: too many open HTTP requests
Could you please help me on this? As this is getting affected in the live databases.
ORA-06512: at "SYS.UTL_HTTP", line 1022
ORA-29270: too many open HTTP requests
CREATE OR REPLACE PROCEDURE Send_To_Spg(
PTRANSACTION_ID IN VARCHAR2,
PCHANNEL_TYPE IN VARCHAR2 DEFAULT NULL,
PCSS_ORDER_NUMBER IN VARCHAR2 DEFAULT NULL,
PTELEPHONE_NUMBER IN VARCHAR2 DEFAULT NULL,
PSCENARIO_TYPE IN VARCHAR2 DEFAULT NULL,
PCUSTOMER_REQUIRED_DATE IN VARCHAR2 DEFAULT NULL,
PCUSTOMER_REQUIRED_TIME IN VARCHAR2 DEFAULT NULL,
PCANCELLATION_REASON IN VARCHAR2 DEFAULT NULL,
PCANCELLATION_NOTES IN VARCHAR2 DEFAULT NULL,
PSMPF_RETENTION IN VARCHAR2 DEFAULT NULL,
PEMERGENCY_WINBACK IN VARCHAR2 DEFAULT NULL,
PCSS_PROJECT_ID IN VARCHAR2 DEFAULT NULL,
PCSS_ORDER_NOTES IN VARCHAR2 DEFAULT NULL,
PREASON_FOR_CESSATION IN VARCHAR2 DEFAULT NULL,
P_RESPONSE OUT VARCHAR2,
PSMART_USER_ID IN VARCHAR2 DEFAULT NULL,
PORACLE_ERROR OUT VARCHAR2,
PORACLE_ERROR_MESSAGE OUT VARCHAR2,
PRESPONSE_TIME OUT NUMBER,
PDATA_TRANSFER_STATUS OUT VARCHAR2)
IS
v_scenario_type VARCHAR2(20); -- Varialble to Hold Time Out of every request to SPG
v_transaction_time NUMBER; -- Total time in which Request to SPG was processed
v_record_inserted_at DATE; -- Date/Time about the record insertion to the Error Handler
v_start_time NUMBER; -- Variable to hold Start Time for calculationg Transaction Time
v_url VARCHAR2(32767);-- URL to use when sending data to SPG
vtransaction_id VARCHAR2(18); -- Variable to hold Transaction ID for the request
v_buffer VARCHAR2(32760);-- Variable to read response from the SPG interface
v_timeout PLS_INTEGER; -- Time Out for each Transaction
v_oracle_err_msg VARCHAR2(600); -- Variable to hold Oracle Error Message
v_resp UTL_HTTP.RESP; -- Response Object
v_req UTL_HTTP.REQ; -- Request Object
v_userid_pwd SMT_ORACLE_PARAMETERS%ROWTYPE; --Variable declared to contain User ID & Password
vl_RetCode VARCHAR2(5000);
vl_std_returnCode VARCHAR2(3000);
--PDATA_TRANSFER_STATUS Holds the Data Transfer Status which can have possible values as
-- N => Data Has not been sent to SPG
-- Y => Received Successful response from SPG
-- F => On the First try to Send data to SPG Oracle Error Occured or response from SPG was a faulure
-- S => On the Second try to Send data to SPG Oracle Error Occured or response from SPG was a faulure
-- T => Data Has been transferred to the Error Log Table
-- X => Data need not be transfered to Error Log Table.
--Location of the timeout, URL & User Id & Password in Standing Data.
c_url_stopwlr SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_WLR';-- Stop WLR URL
c_url_cancelown SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_OWN';-- Cancel own URL
c_url_cancelother SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_OTH';-- Cancel other URL
c_url_amendcrd SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_CRD';--Amend CRD URL
c_spg_useridpwd SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPGIDPWD'; --Contains user id and pwd
ctimeout smt_parameters.parameter_code%TYPE:='SPGTO'; --This holds the timeout parameter
BEGIN
--In case the calling batch process can pass this value this SQL read will not be required & can be deleted
--Read data transfer status for the transaction Id
SELECT data_transfer_status INTO PDATA_TRANSFER_STATUS FROM SPG_INTERFACE_TABLE
WHERE transaction_id = PTRANSACTION_ID;
--Record the start time
v_start_time:=DBMS_UTILITY.GET_TIME;
--If Data transfer status is S then send the record to error handler
IF PDATA_TRANSFER_STATUS = 'S' THEN
Error_Handler(PTRANSACTION_ID,PSMART_USER_ID,PORACLE_ERROR,PORACLE_ERROR_MESSAGE,v_record_inserted_at,PDATA_TRANSFER_STATUS);
ELSE
--In case Data Tranfer Status is something other than S then send the request to SPG
--Initialise other variables which will be populated during the journey
P_RESPONSE := '';
PORACLE_ERROR := NULL;
PORACLE_ERROR_MESSAGE := NULL;
PRESPONSE_TIME := 0;
--Read timeout parameter from standing data.
BEGIN
SELECT VALUE INTO v_timeout FROM smt_parameters WHERE parameter_code=ctimeout;
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_timeout:=30;
WHEN OTHERS THEN
v_timeout:=30;
END;
-- Construct the URL for Stop WLR Scenario
IF PSCENARIO_TYPE = 'STOP_WLR' THEN
BEGIN
-- Read the Initial URL from Standing Data
SELECT VALUE
INTO v_url
FROM SMT_ORACLE_PARAMETERS
WHERE parameter_code = c_url_stopwlr
AND host_id = ( SELECT host_id
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS b
WHERE A.hostname = b.hostname
AND A.database_id = b.database_id));
--handle unforseen exception
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_url:='Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_winback_details'; --After testing the same, URL will be fetched from the Query
WHEN OTHERS THEN
v_url:='Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_winback_details'; --After testing the same, URL will be fetched from the Query
END;
--construct the URL depending on the parameters to be passed to the url
v_url := v_url || '?';
v_url := v_url || 'p_data_entered=' || Smart_Urlencode('xmloverhttp') || '&';
v_url := v_url || 'p_channel_type=' || Smart_Urlencode(PCHANNEL_TYPE)|| '&';
v_url := v_url || 'p_css_start_order_no=' || Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
v_url := v_url || 'p_tel_no=' || Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
v_url := v_url || 'p_crd=' || Smart_Urlencode(PCUSTOMER_REQUIRED_DATE)|| '&';
v_url := v_url || 'p_take_over_time=' || Smart_Urlencode(PCUSTOMER_REQUIRED_TIME)|| '&';
v_url := v_url || 'p_retainsmpf=' || Smart_Urlencode(PSMPF_RETENTION)|| '&';
--v_url := v_url || 'p_emergency_winback=' || Smart_Urlencode(PEMERGENCY_WINBACK)|| '&';
v_url := v_url || 'p_projectno=' || Smart_Urlencode(PCSS_PROJECT_ID)|| '&';
v_url := v_url || 'p_ordernotes=' || Smart_Urlencode(PCSS_ORDER_NOTES)|| '&';
v_url := v_url || 'p_reason_cessation=' || Smart_Urlencode(PREASON_FOR_CESSATION);
ELSIF PSCENARIO_TYPE='CANCEL_OWN' THEN
--Fetch the URL for cancel own from standing data.
BEGIN
SELECT VALUE
INTO v_url
FROM SMT_ORACLE_PARAMETERS
WHERE parameter_code = c_url_cancelown
AND host_id = ( SELECT host_id
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS b
WHERE A.hostname = b.hostname
AND A.database_id = b.database_id));
--handle unforseen exception
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelown_details'; --After testing the same, URL will be fetched from the Query
WHEN OTHERS THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelown_details'; --After testing the same, URL will be fetched from the Query
END;
--construct the URL
v_url := v_url || '?';
v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
v_url := v_url || 'p_css_start_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
v_url := v_url || 'p_cancel_reason=' ||Smart_Urlencode(PCANCELLATION_REASON)|| '&';
v_url:= v_url || 'p_cancel_notes=' ||Smart_Urlencode(PCANCELLATION_NOTES);
ELSIF PSCENARIO_TYPE='CANCEL_OTHER' THEN
--Fetch the URL for cancel own from standing data.
BEGIN
SELECT VALUE
INTO v_url
FROM SMT_ORACLE_PARAMETERS
WHERE parameter_code = c_url_cancelother
AND host_id = ( SELECT host_id
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS b
WHERE A.hostname = b.hostname
AND A.database_id = b.database_id));
--handle unforseen exception
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelother_details'; --After testing the same, URL will be fetched from the Query
WHEN OTHERS THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelother_details'; --After testing the same, URL will be fetched from the Query
END;
--construct the URL
v_url := v_url || '?';
v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
v_url := v_url || 'p_css_stop_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
v_url := v_url || 'p_cancel_reason=' ||Smart_Urlencode(PCANCELLATION_REASON);
ELSIF Pscenario_type='AMEND_CRD' THEN
--Fetch the URL for cancel own from standing data.
BEGIN
SELECT VALUE
INTO v_url
FROM SMT_ORACLE_PARAMETERS
WHERE parameter_code = c_url_amendcrd
AND host_id = ( SELECT host_id
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS b
WHERE A.hostname = b.hostname
AND A.database_id = b.database_id));
--handle unforseen exception
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_amendcrd_details'; -- After testing the same , URL will be fetched from the Query
WHEN OTHERS THEN
v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_amendcrd_details'; -- After testing the same , URL will be fetched from the Query
END;
--construct the URL
v_url := v_url || '?';
v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
v_url := v_url || 'p_css_start_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
v_url := v_url || 'p_crd=' ||Smart_Urlencode(PCUSTOMER_REQUIRED_DATE)|| '&';
v_url := v_url || 'p_css_change_order_numbers='||Smart_Urlencode(PCANCELLATION_REASON);
END IF;
--this is start of setting parameters for utl http object. the show begins...
utl_http.set_transfer_timeout(v_timeout);
--Set the wallet
--XXXXX e.g.UTL_HTTP.SET_WALLET(?file:DirectoryPath?,'put password here?);
--Set proxy
--YYYYY e.g. utl_http.set_proxy(p_proxy_in, p_no_proxy_domains_in);
v_url := REPLACE(v_url,'%27%27','%27'); -- Fix to ensure Double Quotes are converted to Single Quotes
--set the required URL to utl http.
v_req := utl_http.begin_request(v_url);
--Authentication setting
--Fetch the user id and password from stnding data.
BEGIN
SELECT *
INTO v_userid_pwd
FROM SMT_ORACLE_PARAMETERS
WHERE PARAMETER_CODE=c_spg_useridpwd
AND HOST_ID = ( SELECT HOST_ID
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS B
WHERE A.HOSTNAME = B.HOSTNAME
AND A.DATABASE_ID = B.DATABASE_ID));
EXCEPTION
WHEN NO_DATA_FOUND THEN
P_RESPONSE := 'ORACLE_ERROR: USER id AND Password NOT configured IN SMT_ORACLE_PARAMETERS:SPGIDPWD';
WHEN OTHERS THEN
P_RESPONSE := 'ORACLE_ERROR: USER id AND Password NOT configured IN SMT_ORACLE_PARAMETERS:SPGIDPWD';
END;
--utl_http.set_authentication(v_req, p_username_in, p_password_in);
utl_http.set_authentication(v_req, v_userid_pwd.description, v_userid_pwd.VALUE);
v_resp := utl_http.get_response(v_req);
--Fill in the the response time
PRESPONSE_TIME := (DBMS_UTILITY.GET_TIME - v_start_time)/100;
IF v_resp.reason_phrase = 'OK' THEN
-- Fetch the response
BEGIN
LOOP
utl_http.read_line(v_resp, v_buffer);
P_RESPONSE := P_RESPONSE || v_buffer;
END LOOP;
utl_http.end_response(v_resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(v_resp);
P_RESPONSE := P_RESPONSE || v_buffer;
END;
ELSIF v_resp.reason_phrase <> 'OK' OR P_RESPONSE = '' THEN
--error handling starts
--If the HTTP Status is not OK then store the error information
PORACLE_ERROR_MESSAGE := 'Status Code: '|| v_resp.STATUS_CODE||'. Reason Phrase ' ||v_resp.reason_phrase;
P_RESPONSE := 'ORACLE_ERROR: '|| ' Reason Phrase ' || v_resp.reason_phrase;
PORACLE_ERROR := v_resp.STATUS_CODE;
END IF;
--In case we got successful response from SPG
IF P_RESPONSE LIKE '%<RetCde>0</RetCde>%' THEN
PDATA_TRANSFER_STATUS := 'Y';
ELSE
BEGIN
SELECT message
INTO vl_std_returnCode
FROM SMT_MESSAGES
WHERE MESSAGE_CODE='SPGANTIDTS';
EXCEPTION
WHEN NO_DATA_FOUND THEN
vl_std_returnCode := '-12545,-29273,-1,401,';
WHEN OTHERS THEN
vl_std_returnCode := '-12545,-29273,-1,401,';
END;
--In case there was an error do not update Data Transfer Status
IF PORACLE_ERROR <> NULL AND INSTR(vl_std_returnCode, PORACLE_ERROR || ',', 1, 1) <> 0 THEN
PDATA_TRANSFER_STATUS:=PDATA_TRANSFER_STATUS;
ELSE
vl_RetCode := SUBSTR(P_RESPONSE, INSTR(P_RESPONSE,'<RetCde>', 1, 1),
INSTR(P_RESPONSE,'</RetCde>',1,1)+9 - INSTR(P_RESPONSE,'<RetCde>', 1, 1));
BEGIN
SELECT VALUE
INTO vl_std_returnCode
FROM SMT_ORACLE_PARAMETERS
WHERE PARAMETER_CODE='SPGRCS'
AND HOST_ID = ( SELECT HOST_ID
FROM SMART_HOSTS A
WHERE EXISTS ( SELECT 1
FROM DB_PARAMETERS B
WHERE A.HOSTNAME = B.HOSTNAME
AND A.DATABASE_ID = B.DATABASE_ID));
EXCEPTION
WHEN NO_DATA_FOUND THEN
vl_std_returnCode := '<RetCde>4244</RetCde><RetCde>4245</RetCde><RetCde>4246</RetCde>';
WHEN OTHERS THEN
vl_std_returnCode := '<RetCde>4244</RetCde><RetCde>4245</RetCde><RetCde>4246</RetCde>';
END;
IF INSTR(vl_std_returnCode, vl_RetCode, 1, 1) <> 0 THEN
--needs not to re attempted.
PDATA_TRANSFER_STATUS:='X';
ELSE
--In case we did'nt got SUCCESSFUL response FROM SPG THEN UPDATE the Data Transfer Status so that the failed requests can be picked up BY the NEXT batch job RUN
IF PDATA_TRANSFER_STATUS='N' THEN
--initially if data transfer status was N then update it now to F
PDATA_TRANSFER_STATUS := 'F';
ELSIF PDATA_TRANSFER_STATUS='F' THEN
--initially if data transfer status was N then update it now to S
PDATA_TRANSFER_STATUS := 'S';
END IF;
END IF;
END IF;
END IF;
--Now Update all the modified Values
UPDATE SPG_INTERFACE_TABLE
SET response = P_RESPONSE,
data_transfer_status = PDATA_TRANSFER_STATUS,
oracle_error = PORACLE_ERROR,
oracle_error_message = PORACLE_ERROR_MESSAGE,
response_time = PRESPONSE_TIME
WHERE transaction_id = PTRANSACTION_ID;
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
--Handling the unhandled exception
PORACLE_ERROR := SQLCODE;
PORACLE_ERROR_MESSAGE := SQLERRM;
P_RESPONSE := 'ORACLE_ERROR: '|| PORACLE_ERROR_MESSAGE;
PRESPONSE_TIME := (DBMS_UTILITY.GET_TIME - v_start_time)/100;
SELECT data_transfer_status INTO PDATA_TRANSFER_STATUS
FROM SPG_INTERFACE_TABLE
WHERE transaction_id=PTRANSACTION_ID;
--New functionality to update the oracle error and oracle error message and not the Data Transfer Status
BEGIN
SELECT message
INTO vl_std_returnCode
FROM SMT_MESSAGES
WHERE MESSAGE_CODE='SPGANTIDTS';
EXCEPTION
WHEN NO_DATA_FOUND THEN
vl_std_returnCode := '-12545,-29273,-1,';
WHEN OTHERS THEN
vl_std_returnCode := '-12545,-29273,-1,';
END;
vl_RetCode := PORACLE_ERROR || ',';
IF INSTR(vl_std_returnCode, vl_RetCode, 1, 1) <> 0 THEN
--If the error is found in above maintained standing data do not change the Data Transfer Status
pdata_transfer_status:=pdata_transfer_status;
ELSE
IF pdata_transfer_status='N' THEN
PDATA_TRANSFER_STATUS := 'F';
DBMS_OUTPUT.PUT_LINE('DUE TO ERROR DATA COULDN''T GET TRANSFERED TO SPG FOR TRANSACTION'||' '||PTRANSACTION_ID);
DBMS_OUTPUT.PUT_LINE(SQLERRM);
ELSIF pdata_transfer_status='F' THEN
PDATA_TRANSFER_STATUS := 'S';
DBMS_OUTPUT.PUT_LINE('DUE TO ERROR DATA COULDN''T GET TRANSFERED TO SPG FOR TRANSACTION'||' '||PTRANSACTION_ID);
DBMS_OUTPUT.PUT_LINE(SQLERRM);
ELSE
DBMS_OUTPUT.PUT_LINE('Failure WHEN sending data TO Error LOG. Data Transfer Status IS ' || PDATA_TRANSFER_STATUS || '. TRANSACTION ID '|| PTRANSACTION_ID);
END IF;
END IF;
--Now update all the information gathered above to the table
UPDATE SPG_INTERFACE_TABLE
SET response = P_RESPONSE,
data_transfer_status = PDATA_TRANSFER_STATUS,
oracle_error = PORACLE_ERROR,
oracle_error_message = PORACLE_ERROR_MESSAGE,
response_time = PRESPONSE_TIME
WHERE transaction_id = PTRANSACTION_ID;
COMMIT;
END;
/I have fixed the problem by own.
Seems there are some while space in the endpoint url.
Fix
http_req:= utl_http.begin_request
trim(l_endpoint_url)
,'POST'
,'HTTP/1.1'
It works...
Regards
BS -
Ora-06502:pl/sql and ora-06512 at sys.owa_util errors
Greetings -
I have just installed APEX 2.2 in my 9.2.0.7 database and am going through the exercises in the "2 Day+ Application Express Developer's Guide." I was making good progress, until I got to Chapter 5, How to Control Form Layout. I created the script "ht_emp", as instructed. Everything in the script works, except for the "create or replace trigger bi_ht_emp" part. It fails with the following errors:
ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYS.OWA_UTIL", lone 328 ORA-06512: at "SYS.HTP", line 862 ORA-06512: at "SYS.HTP", line 977 ORA-06512: at "SYS.HTP", line 995 ORA-06512: at "FLOWS_020200.WWV_FLOW_SW_API", line 428 ORA-01003: no statement parsed. I have confirmed that nls_length_semantics = BYTE
Any suggestions?
Thanks in advance - GailScott -
Here's the part of the script that chokes --
CREATE OR REPLACE TRIGGER bi_ht_emp
BEFORE INSERT ON ht_emp
FOR EACH ROW
BEGIN
SELECT ht_emp_seq.nextval
INTO :new.emp_id
FROM DUAL;
:new.rec_create_date := SYSDATE;
END;
Thanks fro helping -
Gail
Maybe you are looking for
-
Print Report not working in Run Time
Hello, The Print Report vi doesn't seem to work in the runtime environment. To test it, I made a simple vi that prints the text "Test Page." It works fine (prints the test page to the default printer) on my development computer (as a VI and an execut
-
How to hook up Macbook Pro to Television set
As there's no HDMI port, how do I hook up my laptop to TV?
-
Can I make a call on an iPad?
Can I make a call from an iPad?
-
Movement type for production supply missing in warehouse
Gurus, I am getting this error when i use TC-LP11 movement type for production supply missing in warehouse What should be done?
-
_xlsm replaces .xlsm in a link in my document
I created a document with a link to an excel sheet on our intranet. The link works OK for me and allows me to download the excel sheet. For a number of colleagues this does not work. Reason being the replacement of the period by an underscore. _xlsm