ORA-03113 not recorded as error in procedure
Hi all,
we are running several materialized view refreshes from a procedure. When the procedure encounters error ORA-03113 on one view it doesn't go to exception but just stops.
The refresh part of the procedure is as follows:
begin
dbms_snapshot.refresh ('USR.USRH_SNAPSHOT');
exception
when others then
log_error('USRH_SNAPSHOT');
end;
Is there any reason why ORA-03113 doesn't behave as error when run from procedure?
Is there any special way how to capture this error in the procedure?
We found this error code only when we ran the command manually from SQL Developer.
Thanx for help.
$ oerr ora 3113
03113, 00000, "end-of-file on communication channel"
// *Cause: The connection between Client and Server process was broken.
// *Action: There was a communication error that requires further investigation.
// First, check for network problems and review the SQL*Net setup.
// Also, look in the alert.log file for any errors. Finally, test to
// see whether the server process is dead and whether a trace file
// was generated at failure time.ORA-03113 likely means that corresponding Oracle session has crashed: in this case no exception handler can be called. You need to check this on database side.
Similar Messages
-
THE DATABASE CONNECTION IS LOST :;; WIERD ORA-01012 NOT LOGGED ON ERROR
ERROR: ORA-01012 NOT LOGGED ON ERROR
I AM USING A JAVA SWING INTERFACE (JDK 1.1.8), WHICH USES JNI TO CALL C PROGRAMS WHICH IN TURN CONNECTS TO THE DATABASE, ORACLE 8.1.6.
A DATABASE CONNECTION IS ESTABLISED IN THE MAIN CLASS BY CALLING A FUNCTION FROM THE CONSTRUCTOR.
FOR ALL OTHER FUNCTION CALLS WHICH ARE MADE FROM WITHIN THIS CONSTRUCTOR, THE CONNECTION STAYS.
BUT AFTER THE CONTRUCTOR CALL IS COMPLETE, DATABASE CONNECTION IS STRANGELY LOST. THUS ALL OTHER FUNCTION CALLS FAIL BECAUSE OF CONNECTION ISSUES GIVING ORA-01012. THOUGH IF I CHECK UP IN THE DATABASE, THE CONNECTION DOES FIND AN ENTRY.
SO IT APPEARS THAT SOMEHOW THE JAVA INTERFACE LOOSES TRACK OF CONNECTION. BUT STRANGELY ALL THE FUNCTIONS WORK IF CALLED FROM THE CONSTRUCTOR......... BUT THATS NOT THE IDEA.
PLEASE HELP, THIS PROBLEM IS BUGGING ME FOR WEEKS NOW.
THANKS
AMITapologise for the caps lock.
i am working on a previous system with java swing front end which alread uses jni, and connects to database using pro *c.
My problem is that the connection is lost as soon as the constructor of the main class is run, giving an
ORA-1012 NOT LOGGED ON ERROR.
But if i place the same calls in the contructor all the database call work.
It somehow appears that the java interface looses the connection context. Though the session does find entry in the oracle dynamic tables as long as i dont close the front end main window, thereby meaning that its the jave interface which looses the context.
part of the code of the main class eiquser.
//constructor
public EiqUser() {
super();
initMRI();
private void initMRI() {
try {
/* initialize geoManager environment */
int rccc = new EiqCfuncs().eiqInitEnv();
//eiqinitenv is a c function which connects to database using pro *C
EiqCfuncs cfuncs = new EiqCfuncs();
//EiqCfuncs has the prototypes of c functions used bye the java interface
this.ivjFileMenu.setText(cfuncs.eiqGetText(resNum.getTEXT_FILE_MENU())); // sets the menu name
and so on.........
public void eiqUser_WindowClosed(java.awt.event.WindowEvent windowEvent) {
new EiqCfuncs().eiqTermEnv(); // gives ora-1012 error
//eiqtermenv is supposed to disconnect from data base, but returns an ora-1012 not logged on erro
return;
//eiqtermenv closes the connection with the data base. But fails in this case. if i place the same call ( eiqtermenv) in the initMRI function or the contructor it succeeds.
Plus if i dont use the java interace and use a c stub for executing the same sequence of functions, then i dont face any problems.
the proc calls exectuted ultimately by...
:::eiqinitenv
exec sql connect using :sqlid identified by sqlpw; // succeeds giving sqlerr.sqlcode=0;
::::eiqterm env
exec sql commit work; //fails giving 0ra-1012 error
exec sql rollback work;
Why is the java interface loosing track of the connection once done with the constructor of the main class?? The session still finds an entry in the oracle dynamic tables.
Please help
Thx
Amit -
ORA-03113 End-of-file error after xmltype.transform
I tried to use the xmltype.transform to transform xml data extracted from the database with a xslt contained also in the DB. If I did this with a file of 39 KB, everything works well, but when I did it with a 129 KB xslt file, I got an ora-03113 End of file error.
I suppose the error is connected to the size of the file.
Can everybody help me or suggest some ways to solve the problem?
thank you
Francesco Seriani1)Run a trace on your session.
2)Look at the server to see if an error trace file is getting generated on the database. There may be information in the error log to point toward the underlying problem. -
ORA-03113: end-of-file error inconsitently from Oracle AQ operation
Hi
Here is the weird error we get when we use any Oracle AQ operation. This is very very inconsistent. This is the final pl/sql level code called from sqlplus. Exact code works sometimes and fails other times. We have no explanation why or what we are doing wrong. Any help/ideas from anyone will help
Thanks
sqlplus details:
SQL*Plus: Release 9.2.0.1.0 - Production on Wed Jul 23 14:37:56 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
SQL> connect txg/xxxxxx@joep2k
Connected.
SQL> declare
2
3 enqueue_options DBMS_AQ.enqueue_options_t;
4 message_properties DBMS_AQ.message_properties_t;
5 message_handle RAW(16);
6 message pt_transaction;
7
8 BEGIN
9
10 -- Message := pt_transaction(0,
11 -- p_trans_type, p_country, p_account_id, p_io_id,
12 -- p_core_obj_id, p_orig_trans_id);
13
14 message := pt_transaction(0,
15 2, 'US', 5, 131811,
16 1639956, 0);
17
18 message_properties.priority := 40;
19
20 begin
21 DBMS_AQ.ENQUEUE(queue_name => 'txg.tg_q_transaction',
22 Enqueue_options => enqueue_options,
23 Message_properties => message_properties,
24 Payload => message,
25 Msgid => message_handle);
26 end;
27
28 END;
29 /
declare
ERROR at line 1:
ORA-03113: end-of-file on communication channelI don't think this would help, but we experienced similar strange behavior on 9.2.0.3 running on HP unix. We were simply not able to stop queue: issuing command dbms_admadm.stop_queue(... resulted in error "Not connected". Seems to me like AQ daemon problem - restart of something. We didn't check logs and since user tests are running and queue itself works, even didn't restart database.
But you can check logs and tracefiles for any weird messages.
Also these two database options comes in mind:
-- setup "aq_tm_processes" at least to 4 (because of some bug)
-- same applies to "job_queue_processes" (also at least 4)
Let me know if it works.
Myrra -
ORA-01012: not logged on error while Moving data file with BrTools
Hi,
I'm trying to move a data file to another windows drive with BrTools.
It fails before it actually starts to move the file. The error it shows is:
ORA-01012: not logged on.
Thanks,
Anil.Hi,
BRSPACE has a command option -u to specify the Database user and password. How ever BRSPACE connects to the database as SYSDBA, you do not have to specify the user and password if the operating system user belongs to the dba group.SO check if the user is falling in DBA group with proper authorizations.
PLease reward points for useful answers.
Regards,
Phani -
ORA-00900: invalid SQL statement error in procedure
In procedure we referring only 2 tables
Tables:
1) Edw_orders_ref
2) Change_pl
Condisition:
1) whenever edw_orders_ref.product=change_pl.product and edw_orders_ref.opt=change_pl.opt condisition satisfied then update edw_orders_ref.pl with change_pl.pl column.
2) we pass table name and day values as arguments to the procedure.
3) Based on day column data only we update.
4) Heir day column means partisition values of the table
Procedure is:
create or replace procedure Proc_update_target(P_Day varchar2,p_tablename nvarchar2)
as
TYPE PlCurTyp IS REF CURSOR;
Pl_cv PlCurTyp;
--emp_rec edw_orders_ref%ROWTYPE;
pl_rec Edw_orders_ref.pl%type;
product_rec Edw_orders_ref.product%type;
opt_rec Edw_orders_ref.opt%type;
sql_stmt varchar(3200);
n number:=0;
BEGIN
sql_stmt := 'select lpl.opt,lpl.product,lpl.pl from minddba.change_pl lpl
where exists ( select 1 from '|| p_tablename ||' where '||p_tablename||'.product=lpl.product and '||p_tablename||'.opt=lpl.opt
and '||p_tablename||'.day='||P_Day||' )';
dbms_output.put_line('hi');
OPEN pl_cv FOR sql_stmt ;
LOOP
dbms_output.put_line('hello1');
FETCH Pl_cv INTO pl_rec,product_rec,opt_rec;
EXIT WHEN Pl_cv%NOTFOUND;
dbms_output.put_line('hello');
execute immediate
'update '||p_tablename||' set pl=:rpl
where product=:rproduct
and opt=:ropt
AND day=:day' using pl_rec, product_rec,opt_rec,P_Day;
if Pl_cv%rowcount=10000 then
commit;
end if;
END LOOP;
CLOSE pl_cv;
commit;
exception
when others then
dbms_output.put_line('Error while updating target pl:'||SQLERRM);
end;
it is compile nad debug.
but execution time this error was coming
exec Proc_update_target('20110226','edw_orders_ref')
hi
hello1
hello
Error while updating target pl:ORA-00900: invalid SQL statement
i think in that procedure updata statement is wrong,if any one corect them.Hi,
This are details of table structure and my requirement for that procedure
CREATE TABLE EDW_ORDERS_REF
SO_ID VARCHAR2(20 BYTE) NOT NULL,
SRC_SYS_KY NUMBER(19) NOT NULL,
DAY VARCHAR2(8 BYTE) NOT NULL,
FIN_CLOSE_DT VARCHAR2(8 BYTE) NOT NULL,
SO_LN_ITM_ID VARCHAR2(12 BYTE) NOT NULL,
EXT_EFF_TS VARCHAR2(26 BYTE) NOT NULL,
EFF_FRM_GMT_TS VARCHAR2(26 BYTE) NOT NULL,
CONTRA_FG VARCHAR2(1 BYTE) NOT NULL,
FDW_TRAN_TYPE_CD VARCHAR2(1 BYTE) NOT NULL,
SO4 VARCHAR2(4 BYTE),
SO2 VARCHAR2(2 BYTE),
PUR_AGMT VARCHAR2(20 BYTE),
SF VARCHAR2(6 BYTE),
V_BOX VARCHAR2(18 BYTE),
PL VARCHAR2(30 BYTE),
MCC_CD VARCHAR2(20 BYTE),
OPT VARCHAR2(18 BYTE),
ORDER_UNITS NUMBER(15,3),
SO_OPT_QTY NUMBER(10,3),
SO_DTL_EXT_QT NUMBER(15,3),
ORDER_LIST_LCY NUMBER(18,4),
ORDER_NET_LCY NUMBER(18,4),
ORDER_NET_CLC NUMBER(18,4),
ORDER_LIST_CLC NUMBER(18,4),
CURRENCY_CD VARCHAR2(2 BYTE),
SLS_CHNL_CD VARCHAR2(1 BYTE),
CBN VARCHAR2(20 BYTE),
GEOG_UNIT VARCHAR2(30 BYTE),
PRODUCT VARCHAR2(18 BYTE),
ORDER_NR VARCHAR2(20 BYTE),
ORDER_LINE_NR VARCHAR2(12 BYTE),
LOAD_DT DATE DEFAULT SYSDATE
CREATE TABLE MINDDBA.CHANGE_PL
PRODUCT VARCHAR2(18 BYTE) NOT NULL,
OPT VARCHAR2(3 BYTE) NOT NULL,
PL VARCHAR2(2 BYTE) NOT NULL
1) whenever edw_orders_ref.product=change_pl.product and edw_orders_ref.opt=change_pl.opt condisition satisfied then update edw_orders_ref.pl with change_pl.pl column.
2) we pass table name and day values as arguments to the procedure.
3) Based on day column data only we update.
4) Heir day column means partisition values of the table
When executing this one I got one error like
exec Proc_update_target('20110226','edw_orders_ref');
hi
hello1
hello
ORA-00900: invalid SQL statement -
ORA-00900: invalid SQL statement Error while Executing Procedure
Hi:
I am trying to execute following procedure through java code, but i am getting ORA-00900: invalid SQL statement error.
Procedure is :
<code>
(vResult out int)
as
vCardId varchar2(16);
vForacid varchar2(16);
vApp_Entry_No varchar2(10);
vSrNo number(6);
vCardStatus char(1);
vCardStat char(2);
vExpiryDate date;
Cursor cardCur1 is
select u.card_number,trim(u.ACCOUNT_NUMBER),u.CARD_STATUS,to_char(u.EXPIRY_DATE,'dd-MM-yyyy')
FROM DailyCardData u
where default_indicator='1'
and isprocessed = 'N'
order by expiry_date;
begin
vSrNo := 0;
vResult := 0;
open cardCur1;
Loop
fetch cardCur1 into vCardId,vForacid,vCardStat,vExpiryDate;
if cardCur1%NOTFOUND then
exit;
end if;
if (vCardStat != null) then
vCardStatus := 'H';
elsif (vExpiryDate <= sysdate) then
vCardStatus := 'E';
else
vCardStatus := null;
end if;
select a.app_entry_no into vApp_Entry_No from Application a,ApplicationLinkedAccounts l
where l.foracid = vForacid and l.AcSrNo = '1'
and a.app_entry_no = l.app_entry_no
and a.cardid is null
and a.DOWNLOADFILECREATIONFLAG = 'Y';
update Application set CardId = vCardId,
Card_Status = vCardStatus,APPLICATIONPROCESSEDFLAG = 'Y',
APPLICATIONPROCESSEDdate = DOWNLOADFILECREATIONdate
where App_Entry_No = vApp_Entry_No;
commit;
update DailyCardData set isprocessed = 'Y',app_entry_no = vApp_Entry_No
where card_number = vCardId;
commit;
end Loop;
close cardCur1;
vResult := 1;
end;
</code>
Can any body help me in that?
Thank You,
AnupFirst of all I don't see a procedure header.
Secondly I see you commit inside your procedure. This is a bug.
Thirdly I see you also commit inside a loop. This is also a bug, and needs to be removed asap.
The error indicates a statement doesn't parse. As you don't post the error stack, nor a table definition no one can reproduce the problem.
You need to isolate the statements, one by one, and run them through sql*plus to see what happens.
Sybrand Bakker
Senior Oracle DBA -
My installation running on Windows 2000 Oracle9i. When issue desc table_name i get ORA-03113: end-of-file on communication channel. I have set processes = 300 in parameter file.
The ORA-03113: end-of-file on communication channel error is a generic error. The ORA-03113 error when connecting suggests that the connection was established, but lost later, like a timeout.
There are many possible causes for the ORA-03113 error. See MetaLink Note:17613.1 "ORA-03113":
For example, ORA-3113 could be signaled for any of these scenarios:
- Server machine crashed
- Your server process was killed at O/S level
- Network problems
- Oracle internal errors / aborts on the server
- Client incorrectly handling multiple connections
- etc.. etc.. etc.. - a lot of possible causes !!
It goes on to note that the ORA-03113 End-Of-File error often has additional messages:
It is common for this error to be accompanied by other errors such as:
- ORA-1041 internal error. hostdef extension doesn't exist
- ORA-3114 not connected to ORACLE
- ORA-1012 not logged on
To find more details, check for a trace file in your USER_DUMP_DEST and BACKGROUND_DMP_DEST directory.
Hope this helps . . .
Donald K. Burleson
Oracle Press author
Author of "Oracle Tuning: The Definitive Reference"
http://www.rampant-books.com/book_2005_1_awr_proactive_tuning.htm -
ORA-03113- End Of Communciation-System hangs
Hi, DBA Experts,
Enviornment Server :Oracel 11G/Windows 2008
Client : Windows Xp
While client is working on applications, suddently getting hanging and getting error -ORA-03113.
Getting this error frequently.
Please help me to fix this.
---SVMGSVMG wrote:
Hi, DBA Experts,
Enviornment Server :Oracel 11G/Windows 2008
Client : Windows Xp
While client is working on applications, suddently getting hanging and getting error -ORA-03113.
Getting this error frequently.
Please help me to fix this.
ORA-00600/ORA-07445/ORA-03113 = Oracle bug => search on Metalink and/or call Oracle support -
ORA-03113 error occurs when trying to insert record using procedure
I have a Database Block whose DML Data Target Type is Procedure. I have given the Insert Procedure Name, Insert Procedure Arguments and Insert Procedure ResultSet Columns. The procedure which is used to insert record into the table, resides in the database. The procedure for insert takes Table of records as argument. I am getting FRM-40735: INSERT-PROCEDURE trigger raised unhandled exception ORA-03113).
This exception does not occur if the Procedure is place under Program Units. But, I want the procedure to be under Database Block. I am working on Oracle Forms 6i.
Please help me out in resolving this.Hello,
I think you should call the support for this kind of error.
Francois -
Error ORA-03113 when execute procedure via OEM
Hi All,
I got error messages
ORA-03113: end-of-file on communication channel
ERROR at line 1:
ORA-03114: not connected to ORACLE
when execute procedure via Oracle Enterprise Manager
Who do you know what 's the problem and how can I resolves ?
Thanks,
MckaSolution Description:
=====================
The ORA-3113 error is a general error reported by Oracle client tools,
which signifies that they cannot communicate with the oracle shadow
process. As it is such a general error more information must be collected
to help determine what has happened.
This short article describes what information to collect for an
ORA-3113 error when the Oracle server is on a Unix platform.
General Issues:
===============
1) Is it only one tool that encounters the error or
do you get an ORA-3113 from any tool doing a similar operation?
If the problem reproduces in SQL*Plus, use this in all tests
below.
2) Check if the problem is just restricted to:
[ ] One particular UNIX user,
[ ] Any UNIX user
or [ ] Any UNIX user EXCEPT as the Oracle user.
3) Check if the problem is just restricted to:
[ ] One particular ORACLE logon
or [ ] Any ORACLE logon that has access to the
relevant tables.
4) If you have a client-server configuration does this occur from:
[ ] Any client
[ ] Just one particular client
or [ ] Just one group of clients ?
If so what do these clients have in common ?
Eg: Software release .
5) Do you have a second server or database version where the
same operation works correctly? -
ERROR in PROCEDURE PL/SQL: ORA-00947: not enough values
Hi all i am creating a Procedure in which i am getting very strange ERROR
h4. i am using Oralce 11g, SQL Developer 3
my scenario is :
CREATE SEQUENCE tt_TMPMEASURESOURCE_ID
START WITH 1
INCREMENT BY 1;
CREATE TABLE tt_TMPMEASURESOURCE
ID NUMBER(10,0) ,
OBJNAME VARCHAR2(200) ,
PRSP NUMBER(10,0) ,
SOURCEID NUMBER(10,0) ,
SOURCENAME VARCHAR2(100) ,
FIX NUMBER(3,0) ,
MNAME VARCHAR2(1000) ,
MDESC VARCHAR2(1000)
CREATE OR REPLACE TRIGGER tt_TMPMEASURESOURCE_ID_TRG
BEFORE INSERT
ON tt_TMPMEASURESOURCE
FOR EACH ROW
BEGIN
SELECT tt_TMPMEASURESOURCE_ID.NEXTVAL INTO :NEW.ID
FROM DUAL;
END;
INSERT INTO TT_TMPMEASURESOURCE
*(OBJNAME,PRSP,SOURCEID,SOURCENAME,FIX,MNAME,MDESC)*
values ('rajnish',43,54,'anish',4,'apple','kumar');
output :
+1 row inserted+
h4. select * from TT_TMPMEASURESOURCE;
h3. 1 rajnish 43 54 anish 4 apple kumar
creating and compiling Procedure
create or replace procedure tem_test
as
begin
INSERT INTO tt_TmpMeasureSource
*(OBJNAME,PRSP,SOURCEID,SOURCENAME,FIX,MNAME,MDESC)*
VALUES ( v_ObjName, v_PrespectiveID, v_SourceID, v_SourceName, v_FIX, v_MName, v_MDesc );
when compiling
Error(63,16): PL/SQL: SQL Statement ignored
Error(63,28): PL/SQL: ORA-00947: not enough values
i am do not understand that when Trigger A trigger is allready there for 1st column
then why its giving me this error?
please help me out
thanksi got my solutions
creating and compiling Procedure
create or replace procedure tem_test
as
begin
INSERT INTO tt_TmpMeasureSource
*(OBJNAME,PRSP,SOURCEID,SOURCENAME,FIX,MNAME,MDESC)*
VALUES ( v_ObjName, v_PrespectiveID, v_SourceID, v_SourceName, v_FIX, v_MName, v_MDesc );
it was a typography mistake
this line was missing in Original procedure
*(OBJNAME,PRSP,SOURCEID,SOURCENAME,FIX,MNAME,MDESC)*thanks -
Hello,
"C:\app\xps\product\11.2.0\dbhome_1" where is my installation of database oracle enterprise 11g; I use Windows 7 Pro.
I have in System PATH : C:\app\xps\product\11.2.0\dbhome_1\bin
I have in HKEY_LOCAL_MACHINE > SOFTWARE > ORACLE > SYSMAN > OracleDBConsoleorcl : "ORACLE_HOME" value "C:\app\xps\product\11.2.0\dbhome_1"
When i execute "sqlplus / as sysdba" command, i receive error: "The procedure entry point longjmp could not be found in the dynamic link lib. orauts.dll" and "Error ORA-12560"
If i execute
set ORACLE_HOME=C:\app\xps\product\11.2.0\dbhome_1
C:\>set PATH=%ORACLE_HOME%\bin;%PATH%
sqlplus "/ as sysdba"
I don't receive Error.
Why?You don't mention which specific version of the operating system that you are using - Windows XP, Vista, or 7 and whether you're using a 32-bit or 64-bit version.
FWIW, kernell32.dll is a Windows system-level module, so it's possible that you have some corruption in your Windows installation which is preventing FM from launching.
Also, 2Gb of RAM is a bit lean for FM. -
ORA-03113 error on basic insert using XML
I am getting this error:
Connected to:
Oracle Database 10g Release 10.2.0.1.0 - Production
SQL> desc edi_holidays
Name Null? Type
HOLIDAY DATE
SQL> alter session set sql_trace=true;
Session altered.
SQL> truncate table edi_holidays;
Table truncated.
SQL> SELECT to_date(extractvalue(COLUMN_VALUE, '/SubValueMark/@Value'),
2 'mm/dd/yyyy') holidays
3 FROM xmltable('/root/Record[1]/ValueMark[@Index > 10]/SubValueMark'
4 passing prl_bpl_api.getediholidays('edi', 'SF.PARMS'));
HOLIDAYS
29-MAY-06
04-JUL-06
04-SEP-06
23-NOV-06
24-NOV-06
25-DEC-06
26-DEC-06
01-JAN-06
8 rows selected.
SQL> INSERT INTO edi_holidays
2 SELECT to_date(extractvalue(COLUMN_VALUE, '/SubValueMark/@Value'),
3 'mm/dd/yyyy') holidays
4 FROM xmltable('/root/Record[1]/ValueMark[@Index > 10]/SubValueMark'
5 passing prl_bpl_api.getediholidays('edi', 'SF.PARMS'));
8 rows created.
SQL> commit;
Commit complete.
SQL> select * from edi_holidays;
HOLIDAY
29-MAY-06
04-JUL-06
04-SEP-06
23-NOV-06
24-NOV-06
25-DEC-06
26-DEC-06
01-JAN-06
8 rows selected.
SQL> begin
2 INSERT INTO edi_holidays
3 SELECT to_date(extractvalue(COLUMN_VALUE, '/SubValueMark/@Value'),
4 'mm/dd/yyyy') holidays
5 FROM xmltable('/root/Record[1]/ValueMark[@Index > 10]/SubValueMark'
6 passing prl_bpl_api.getediholidays('edi', 'SF.PARMS'));
7
8 end;
9 /
begin
ERROR at line 1:
ORA-03113: end-of-file on communication channelAny idea what might be happening. I also checked this in another session (with the anonymous block).
Connected.
SQL> begin
2 insert into edi_holidays select sysdate from dual;
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> select * from edi_holidays;
HOLIDAY
18-SEP-06Below is the relevant code.
In here the procedure sys_sys_utility.processerror is a Autonomous Transaction procedure for Error Logging
and sys_sys_utility.who_am_i is a program pretty much reused from here
http://asktom.oracle.com/~tkyte/who_called_me/who.sql
Also, sys_sys_soapapi is an api provided to me to implement the SOAP Protocol.
SQL> desc edi_holidays;
Name Null? Type
HOLIDAY DATE
CREATE OR REPLACE PACKAGE sys_sys_soapapi IS
TYPE t_request IS RECORD(
method VARCHAR2(256)
,namespace VARCHAR2(256)
,BODY CLOB
,envelope_tag VARCHAR2(30));
TYPE t_response IS RECORD(
doc xmltype
,envelope_tag VARCHAR2(30));
FUNCTION new_request
p_method IN VARCHAR2
,p_namespace IN VARCHAR2
,p_envelope_tag IN VARCHAR2 DEFAULT 'SOAP-ENV'
) RETURN t_request;
PROCEDURE add_parameter
p_request IN OUT NOCOPY t_request
,p_name IN VARCHAR2
,p_type IN VARCHAR2
,p_value IN CLOB
PROCEDURE add_parameter
p_request IN OUT NOCOPY t_request
,p_name IN VARCHAR2
,p_type IN VARCHAR2
,p_value IN xmltype
FUNCTION invoke
p_request IN OUT NOCOPY t_request
,p_url IN VARCHAR2
,p_action IN VARCHAR2
) RETURN t_response;
FUNCTION get_return_value
p_response IN OUT NOCOPY t_response
,p_name IN VARCHAR2
,p_namespace IN VARCHAR2
) RETURN VARCHAR2;
END sys_sys_soapapi;
CREATE OR REPLACE PACKAGE BODY sys_sys_soapapi IS
FUNCTION new_request(p_method IN VARCHAR2,
p_namespace IN VARCHAR2,
p_envelope_tag IN VARCHAR2 DEFAULT 'SOAP-ENV')
RETURN t_request AS
v_request t_request;
BEGIN
v_request.method := p_method;
v_request.namespace := p_namespace;
v_request.envelope_tag := p_envelope_tag;
RETURN v_request;
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i || 'new_request');
RAISE;
END;
PROCEDURE add_parameter(p_request IN OUT NOCOPY t_request,
p_name IN VARCHAR2,
p_type IN VARCHAR2,
p_value IN CLOB) AS
BEGIN
p_request.BODY := p_request.BODY || '<' || p_name || ' xsi:type="' ||
p_type || '">' || p_value || '</' || p_name || '>';
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i || 'add_parameter');
RAISE;
END add_parameter;
PROCEDURE add_parameter(p_request IN OUT NOCOPY t_request,
p_name IN VARCHAR2,
p_type IN VARCHAR2,
p_value IN xmltype) AS
BEGIN
dbms_output.put_line('xmlversion');
/* p_request.BODY := p_request.BODY || '<' || p_name || ' xsi:type="' ||
p_type || '">' || p_value.getclobval ||
'></' || p_name || '>'; */
p_request.BODY := p_request.BODY || '<' || p_name || ' xsi:type="' ||
p_type || '"><![CDATA[' || p_value.getclobval || ']]></' ||
p_name || '>';
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i || 'add_parameter');
RAISE;
END add_parameter;
PROCEDURE generate_envelope(p_request IN OUT NOCOPY t_request,
p_env IN OUT NOCOPY CLOB) AS
BEGIN
p_env := '<?xml version="1.0" encoding="utf-8" ?><' ||
p_request.envelope_tag || ':Envelope xmlns:' ||
p_request.envelope_tag ||
'="http://schemas.xmlsoap.org/soap/envelope/" ' ||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' || '<' ||
p_request.envelope_tag || ':Body>' || '<' || p_request.method || ' ' ||
p_request.namespace || '>' || p_request.BODY || '</' ||
p_request.method || '>' || '</' || p_request.envelope_tag ||
':Body>' || '</' || p_request.envelope_tag || ':Envelope>';
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i ||
'generate_envelope');
RAISE;
END generate_envelope;
PROCEDURE show_envelope(p_env IN CLOB) AS
i PLS_INTEGER;
v_len PLS_INTEGER;
BEGIN
i := 1;
v_len := length(p_env);
WHILE (i <= v_len)
LOOP
dbms_output.put_line(substr(p_env, i, 255));
i := i + 255;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i || 'show_envelope');
RAISE;
END show_envelope;
PROCEDURE check_fault(p_response IN OUT NOCOPY t_response) AS
v_fault_node xmltype;
v_fault_code VARCHAR2(256);
v_fault_string VARCHAR2(32767);
BEGIN
v_fault_node := p_response.doc.extract('/' || p_response.envelope_tag ||
':Fault',
'xmlns:' || p_response.envelope_tag ||
'="http://schemas.xmlsoap.org/soap/envelope/');
IF (v_fault_node IS NOT NULL)
THEN
v_fault_code := v_fault_node.extract('/' || p_response.envelope_tag ||
':Fault/faultcode/child::text()',
'xmlns:' || p_response.envelope_tag ||
'="http://schemas.xmlsoap.org/soap/envelope/')
.getstringval();
v_fault_string := v_fault_node.extract('/' || p_response.envelope_tag ||
':Fault/faultstring/child::text()',
'xmlns:' || p_response.envelope_tag ||
'="http://schemas.xmlsoap.org/soap/envelope/')
.getstringval();
raise_application_error(-20000, v_fault_code || ' - ' || v_fault_string);
END IF;
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i || 'check_fault');
RAISE;
END check_fault;
FUNCTION invoke(p_request IN OUT NOCOPY t_request,
p_url IN VARCHAR2,
p_action IN VARCHAR2) RETURN t_response AS
v_envelope CLOB;
v_http_request utl_http.req;
v_http_response utl_http.resp;
v_response t_response;
v_rawresponse CLOB;
v_request_len INTEGER;
v_request_indx INTEGER := 1;
v_request_txt VARCHAR(32767);
BEGIN
generate_envelope(p_request, v_envelope);
--show_envelope(v_envelope);
v_http_request := utl_http.begin_request(p_url, 'POST', 'HTTP/1.1');
utl_http.set_header(v_http_request, 'Content-Type', 'text/xml');
v_request_len := length(v_envelope);
utl_http.set_header(v_http_request, 'Content-Length', v_request_len);
utl_http.set_header(v_http_request, 'SOAPAction', p_action);
--Send Request Piecewise
v_request_indx := 1;
LOOP
EXIT WHEN v_request_indx >= v_request_len;
v_request_txt := substr(v_envelope, v_request_indx, 32767);
utl_http.write_text(v_http_request, v_request_txt);
v_request_indx := v_request_indx + 32767;
END LOOP;
--Get Response
v_http_response := utl_http.get_response(v_http_request);
--Extract Response Text
BEGIN
LOOP
utl_http.read_text(v_http_response, v_envelope);
v_rawresponse := v_rawresponse || v_envelope;
END LOOP;
EXCEPTION
WHEN utl_http.end_of_body THEN
NULL;
WHEN OTHERS THEN
dbms_output.put_line('In the invoke utl_http.read_text procedure');
RAISE;
END;
-- End Response
utl_http.end_response(v_http_response);
--Format My Response
v_response.doc := xmltype.createxml(v_rawresponse);
v_response.envelope_tag := p_request.envelope_tag;
-- Remove Envelope Headers
v_response.doc := v_response.doc.extract('/' || v_response.envelope_tag ||
':Envelope/' ||
v_response.envelope_tag ||
':Body/child::node()',
'xmlns:' || v_response.envelope_tag ||
'="http://schemas.xmlsoap.org/soap/envelope/"');
/*BEGIN
NULL;
show_envelope(v_response.doc.getstringval());
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error in show envelope: ' || SQLERRM);
END;*/
check_fault(v_response);
RETURN v_response;
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i || 'invoke');
RAISE;
END invoke;
FUNCTION get_return_value(p_response IN OUT NOCOPY t_response,
p_name IN VARCHAR2,
p_namespace IN VARCHAR2) RETURN VARCHAR2 AS
BEGIN
RETURN p_response.doc.extract('//' || p_name || '/child::text()',
p_namespace) .getstringval();
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i ||
'get_return_value');
RAISE;
END get_return_value;
END sys_sys_soapapi;
FUNCTION getediholidays(p_suser sys_user.username%TYPE DEFAULT NULL,
p_transkey VARCHAR2) RETURN xmltype IS
l_request sys_sys_soapapi.t_request;
l_response sys_sys_soapapi.t_response;
--l_response_value VARCHAR2(500);
v_action VARCHAR2(1000);
l_response_xml xmltype;
BEGIN
-- Set proxy details if no direct net connection.
--UTL_HTTP.set_proxy('myproxy:4480', NULL);
--UTL_HTTP.set_persistent_conn_support(TRUE);
v_action := v_prelude_ws_action || '/GetEdiHolidays';
l_request := sys_sys_soapapi.new_request(p_method => 'GetEdiHolidays',
p_namespace => v_prelude_ws_namespace,
p_envelope_tag => 'soap');
sys_sys_soapapi.add_parameter(p_request => l_request,
p_name => 'sAccount',
p_type => 'xsd:string',
p_value => v_prelude_ws_account);
sys_sys_soapapi.add_parameter(p_request => l_request,
p_name => 'sUser',
p_type => 'xsd:string',
p_value => p_suser);
sys_sys_soapapi.add_parameter(p_request => l_request,
p_name => 'sTransKey',
p_type => 'xsd:string',
p_value => p_transkey);
l_response := sys_sys_soapapi.invoke(p_request => l_request,
p_url => v_prelude_ws_url,
p_action => v_action);
--dbms_output.put_line('hi ' || l_response.doc.getstringval());
SELECT extract(l_response.doc,
'/GetEdiHolidaysResponse/GetEdiHolidaysResult/child::node()',
v_prelude_ws_namespace)
INTO l_response_xml
FROM dual;
RETURN l_response_xml;
EXCEPTION
WHEN OTHERS THEN
sys_sys_utility.processerror(SQLCODE,
'[' || SQLERRM || ']',
sys_sys_utility.who_am_i || 'getediholidays');
RAISE;
END getediholidays;Mark, also, please feel free to comment on any improvements in the code. btw, if this doesn't work, I am planning to go and use collections to get the holidays and then make use of them.
Message was edited by:
rputtagunta -
PL/SQL: ORA-22806: not an object or REF when Using Record in Package
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
I have declared a record type in my package
create or replace
PACKAGE MYPKG AS
TYPE MYREC IS RECORD (VAL1 varchar2(20), val2 date);
PROCEDURE display_error (pSQLERRM number);
PROCEDURE P_LOAD_DATA (pStartDate Date, pEndDate Date);
FUNCTION F_EPI(refno1 in NUMBER, refno2 in NUMBER) return MYREC;
END MYPKG;
--In My Package Body
FUNCTION F_EPI(refno1 in NUMBER, refno2 in NUMBER) return MYREC is
F_param MYREC;
BEGIN
select myvarchar2, mydate into MYREC from MYTable
where myrefno1 = refno1
and myrefno2 = refno2
Exception
when others then
display_error(SQLERRM);
RETURN F_param;
END F_EPI ;
PROCEDURE P_LOAD_DATA (pStartDate Date, pEndDate Date) IS
insert into atable(myvarchar, mydate)
select F_EPI(refno1,refno2).val1,F_EPI(refno1,refno2).val2 from tab2;
END P_LOAD_DATA;
I get errors
Error(187,7): PL/SQL: SQL Statement ignored
Error(225,7): PLS-00382: expression is of wrong type
Error(225,7): PL/SQL: ORA-22806: not an object or REF
When I compile the package.
When I try to call the function from SQL I get an Invalid datatype error.Hi,
Before posting any query/plsql blocks, please ensure that you have written it clean and complete with less syntax errors. ( at least general syntax errors, you can avoid). Then somebody can have an interest to check your logical error.
About your posting, refer below solution step-by-step. It may help you, about what you are looking for? By the way, you must be knowing, what you are going to to do with. I haven't concentrated about your requirement; as it was not missing in your posting.
drop table test;
create table test(myvarchar varchar2(20), mydate date);
create or replace
package mypkg as
type myrec is record (val1 varchar2(20), val2 date);
--procedure display_error (psqlerrm in number); -- if you are passing sqlerrm, then parameter needs to be string type
procedure display_error (psqlerrm in varchar2);
procedure p_load_data (pstartdate in date, penddate in date);
function f_epi(refno1 in number, refno2 in number) return myrec;
end mypkg;
Package created.
--in my package body
create or replace
package body mypkg as -- added
procedure display_error (psqlerrm in varchar2) -- if you are declared a proc/func in spec, it needs to define in pkg body
is
begin
null; -- you should know, what to do here
dbms_output.put_line('Err -'||sqlerrm);
end display_error;
function f_epi(refno1 in number,refno2 in number)
return myrec
is
f_param myrec;
begin
-- select myvarchar2, mydate into MYREC from mytable
-- where myrefno1 = refno1
-- and myrefno2 = refno2;
select ename, hiredate into f_param from emp -- added demo logic by using emp
where empno = refno1
and mgr = refno2;
return f_param; -- added
exception
when others then
raise; -- if you are using OTHERS then, just raise it
display_error(sqlerrm);
--return f_param; -- what is this?
end f_epi;
procedure p_load_data (pstartdate in date, penddate in date) -- you must be knowing the use of 2 params ???
is
v_rec myrec; -- added
begin -- Added
--insert into atable(myvarchar, mydate)
-- select f_epi(refno1,refno2).val1,f_epi(refno1,refno2).val1 from tab2;
-- demo logic added with static params to call f_epi
v_rec:= f_epi(7499,7698);
insert into test values v_rec;
--null;
end p_load_data;
end mypkg;
Package body created.
SQL> exec mypkg.p_load_data(null,null);
PL/SQL procedure successfully completed.
SQL> select * from test;
MYVARCHAR MYDATE
ALLEN 20-FEB-81
Thanks!
Maybe you are looking for
-
It all comes back to me now - been retired from the corporate world for 3 years and when I did to turned MAC. A wonderful day. Over the weekend I was helping my daughter. She has a 20"iMac but need to get a PC so she could work from home (Cyrix softw
-
Accessing ECC tables from XSLT mapping
Hi All, I have requirement where I need to access a SAP table from PI XSLT mapping. Pls provide inputs on how to achieve it. Thanks, Navneeth K.
-
Risks and benefits with developement platforms?
Hi, I'm wondering about the risks involved with different developement platforms such as xampp or other software like it. Previously I've been running EasyPHP and xampp as well as apache php and mysql each by them self in a windows environment restri
-
Export large xml file in PL/SQL
How to export large or big xml (XMLTYPE) into file system. I have tried with... 1. UTL_FILE.PUT -- it has a limitation of 32767 chars 2. DBMS_XSLPROCESSOR.CLOB2FILE supports little more than UTL_FILE but not in MB's i'm looking for options to export
-
Distiller 8 Server issue on a Virtual Server
We had distiller Server V8 running on a windows 2003 3 server and had no known problems. We had that server virtualized and we are beginning to see an issue and wonder if it is related. We have multiple watched folders receiving .ps files from two