PLS-00307: too many declarations of 'INSERTXML' match this call
Dear All,
I need help to create a procedure. I am describing the scenario below.
I have a table which is
xml_clob(
doc_id number,
doc clob
The above table contain an xml file in doc column. What i need is read the doc column and parse and insert the xml data to a table. For this purpose I am using a built-in package in oracle database 10g name dbms_xmlsave. To full fill my purpose i am going to create a procedure which is getting error. I am giving the procedure code
CREATE OR REPLACE PROCEDURE loadxml1 AS
fil clob;
buffer varchar2(1000);
len INTEGER;
insrow INTEGER;
BEGIN
SELECT doc INTO fil FROM xml_clob WHERE doc_id=1;
len := DBMS_LOB.GETLENGTH(fil);
DBMS_OUTPUT.PUT_LINE('length '||len);
DBMS_LOB.READ(fil,len,1,buffer);
--xmlgen.resetOptions;
--insrow := xmlgen.insertXML('xml_doc',buffer);
insrow := dbms_xmlsave.insertXML('xml_doc',buffer);
--insrow := dbms_xmlsave.insertXML('xml_doc',fil);
DBMS_OUTPUT.PUT_LINE('length ins '||insrow);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('In Exception');
DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
end;
i am getting the error with the bold line
insrow := dbms_xmlsave.insertXML('xml_doc',buffer);
PLS-00307: too many declarations of 'INSERTXML' match this call
I need help on this. Here the argument xml_doc is the table name where i want to insert data from xml.
I am giving u the code of dbms_smlsave package which is at sys user.
CREATE OR REPLACE PACKAGE DBMS_XMLSAVE AUTHID CURRENT_USER AS
SUBTYPE ctxType IS NUMBER; /* context type */
DEFAULT_ROWTAG CONSTANT VARCHAR2(3) := 'ROW'; /* rowtag */
DEFAULT_DATE_FORMAT CONSTANT VARCHAR2(21):= 'YYYY-MM-DD HH24:MI:SS';
MATCH_CASE CONSTANT NUMBER := 0; /* match case */
IGNORE_CASE CONSTANT NUMBER := 1; /* ignore case */
-------------------- constructor/destructor functions ---------------------
FUNCTION newContext(targetTable IN VARCHAR2) RETURN ctxType;
PROCEDURE closeContext(ctxHdl IN ctxType);
-------------------- parameters to the save (XMLtoDB) engine ----------------
PROCEDURE setXSLT(ctxHdl IN ctxType,uri IN VARCHAR2,ref IN VARCHAR2 := null);
PROCEDURE setXSLT(ctxHdl IN ctxType, stylesheet IN CLOB, ref IN VARCHAR2 := null);
PROCEDURE setXSLTParam(ctxHdl IN ctxType,name IN VARCHAR2,value IN VARCHAR2);
PROCEDURE removeXSLTParam(ctxHdl IN ctxType, name IN VARCHAR2);
PROCEDURE setRowTag(ctxHdl IN ctxType, tag IN VARCHAR2);
PROCEDURE setSQLToXMLNameEscaping(ctxHdl IN ctxType, flag IN BOOLEAN := true);
PROCEDURE setPreserveWhitespace(ctxHdl IN ctxType, flag IN BOOLEAN := true);
PROCEDURE setIgnoreCase(ctxHdl IN ctxType, flag IN NUMBER);
PROCEDURE setDateFormat(ctxHdl IN ctxType, mask IN VARCHAR2);
PROCEDURE setBatchSize(ctxHdl IN ctxType, batchSize IN NUMBER);
PROCEDURE setCommitBatch(ctxHdl IN ctxType, batchSize IN NUMBER);
-- set the columns to update. Relevant for insert and update routines..
PROCEDURE setUpdateColumn(ctxHdl IN ctxType, colName IN VARCHAR2);
PROCEDURE clearUpdateColumnList(ctxHdl IN ctxType);
-- set the key column name to be used for updates and deletes.
PROCEDURE setKeyColumn(ctxHdl IN ctxType, colName IN VARCHAR2);
PROCEDURE clearKeyColumnList(ctxHdl IN ctxType);
------------------- save ----------------------------------------------------
-- insertXML
FUNCTION insertXML(ctxHdl IN ctxType, xDoc IN VARCHAR2) RETURN NUMBER;
FUNCTION insertXML(ctxHdl IN ctxType, xDoc IN CLOB) RETURN NUMBER;
-- updateXML
FUNCTION updateXML(ctxHdl IN ctxType, xDoc IN VARCHAR2) RETURN NUMBER;
FUNCTION updateXML(ctxHdl IN ctxType, xDoc IN CLOB) RETURN NUMBER;
-- deleteXML
FUNCTION deleteXML(ctxHdl IN ctxType, xDoc IN VARCHAR2) RETURN NUMBER;
FUNCTION deleteXML(ctxHdl IN ctxType, xDoc IN CLOB) RETURN NUMBER;
------------------- misc ----------------------------------------------------
PROCEDURE propagateOriginalException(ctxHdl IN ctxType, flag IN BOOLEAN);
PROCEDURE getExceptionContent(ctxHdl IN ctxType, errNo OUT NUMBER, errMsg OUT VARCHAR2);
PROCEDURE useDBDates(ctxHdl IN ctxType, flag IN BOOLEAN := true);
-------private method declarations------------------------------------------
-- we must do this as a bug workaround; otherwise we get ora-600 [kgmexchi11]
PROCEDURE p_useDBDates(ctxHdl IN ctxType, flag IN NUMBER);
PROCEDURE p_setXSLT(ctxHdl IN ctxType, uri IN VARCHAR2, ref IN VARCHAR2);
PROCEDURE p_setXSLT(ctxHdl IN ctxType, stylesheet CLOB, ref IN VARCHAR2);
PROCEDURE p_propagateOriginalException(ctxHdl IN ctxType, flag IN NUMBER);
PROCEDURE p_setSQLToXMLNameEsc(ctxHdl IN ctxType, flag IN NUMBER);
PROCEDURE p_setPreserveWhitespace(ctxHdl IN ctxType, flag IN NUMBER);
END dbms_xmlsave;
CREATE OR REPLACE PACKAGE BODY DBMS_XMLSAVE AS
FUNCTION insertXML(ctxHdl IN ctxType, xDoc IN VARCHAR2) RETURN NUMBER
as LANGUAGE JAVA NAME
'oracle.xml.sql.dml.OracleXMLStaticSave.insertXML(int, java.lang.String) return int';
FUNCTION insertXML(ctxHdl IN ctxType, xDoc IN CLOB) RETURN NUMBER
as LANGUAGE JAVA NAME
'oracle.xml.sql.dml.OracleXMLStaticSave.insertXML(int, oracle.sql.CLOB) return int';
END DBMS_XMLSAVE;
/
Hi,
It's surprising (to me) that you're getting that particular error.
It's not surprising that you're getting some error, since insertXML is expecting the first argument to be a ctxType, and you're passing a VARCHAR2 instead. Create a ctxType, and use it as the first argument. (Sorry, I'm not familiar with that package, so I can't give you any details.)
Similar Messages
-
PLS-00307: too many declarations of ' F ' match this call
Hi friends,
I have created a package(OL) using procedure overloading.
Package Specification:
CREATE OR REPLACE package SDR_SPRUSR.ol as
procedure f (p number);
procedure f (p varchar2);
procedure f (p varchar2,q number);
procedure f (p number,q varchar2);
procedure f (p number,q number,r varchar2);
end;
Package Body:
CREATE OR REPLACE package body SDR_SPRUSR.ol as
procedure f (p number) is
begin
dbms_output.put_line('f <number> called');
end;
procedure f (p varchar2) is
begin
dbms_output.put_line('f <varchar> called');
end;
procedure f (p varchar2, q number) is
begin
dbms_output.put_line('f <varchar> called,f <number> called');
end;
procedure f (p number,q varchar2) is
begin
dbms_output.put_line('f <number> called,f <varchar> called');
end;
procedure f (p number,q number,r varchar2) is
begin
dbms_output.put_line('f <number> called,f <number> called,f <varchar> called');
end;
end;
But, here is the problem:
When I pass NULL as a parameter like
BEGIN
SDR_SPRUSR.OL.F ( NULL );
END;
I'm getting an error in SQL*Plus:
ERROR at line 3:
ORA-06550: line 3, column 4:
PLS-00307: too many declarations of 'F' match this call
ORA-06550: line 3, column 4:
PL/SQL: Statement ignored
How can I catch this error? Please provide me an appropriate solution..
(My requirement is to display a user friendly message when NULL is passed.)
Thank you.
Regards,
Vivek
Edited by: 847837 on Mar 28, 2011 1:35 AMCan't we display a user friendly message showing "PASS SUFFICIENT VALUES"? Why then no change your function as follows
procedure f (p number) is
begin
if p is null then
dbms_output.put_line('f <number> called ==> pass sufficient values');
end if;
end;But even in this case you need to qualify your input parameter with to_number of to_char for the overloading to work correctly
or give default value for your parameter if possible
Best regards
Mohamed Houri -
PLS-00307: too many declarations of 'DEFINE_COLUMN' match this call
Compilation of this procedure issues 'PLS-00307: too many declarations of 'DEFINE_COLUMN' match this call'.
Here is the code:
PROCEDURE leggi_comp (tabella spre_005.nome_table%type, cen dinf_027.cd_centro%type, prat dinf_027.nr_pratica%type,
serv dinf_027.cd_servizio%type, fase dinf_027.cd_fase%type, dt_ril dinf_027.dt_rilev%type,
comp_out out dinf_027.cd_compilatore%type) IS
source_cursor number;
v_cen dinf_027.cd_centro%type;
v_prat dinf_027.nr_pratica%type;
v_serv dinf_027.cd_servizio%type;
v_fase dinf_027.cd_fase%type;
v_dt_ril dinf_027.dt_rilev%type;
v_comp_out dinf_027.cd_compilatore%type;
myreturn number;
BEGIN
source_cursor := dbms_sql.open_cursor;
v_cen := cen;
v_prat := prat;
v_serv := serv;
v_fase := fase;
v_dt_ril := dt_ril;
dbms_sql.parse (source_cursor,
'select cd_compilatore from ' || tabella||' where
cd_centro = :cen and
nr_pratica = :prat and
cd_servizio = :serv and
cd_fase = :fase and
dt_rilev = :dt_ril',dbms_sql.v7);
dbms_sql.bind_variable(source_cursor, 'cen', v_cen);
dbms_sql.bind_variable(source_cursor, 'prat', v_prat);
dbms_sql.bind_variable(source_cursor, 'serv', v_serv);
dbms_sql.bind_variable(source_cursor, 'fase', v_fase);
dbms_sql.bind_variable(source_cursor, 'dt_ril',v_dt_ril);
dbms_sql.define_column(source_cursor, 1, v_comp_out);
myreturn := dbms_sql.execute(source_cursor);
myreturn := dbms_sql.fetch_rows(source_cursor);
dbms_sql.column_value(source_cursor,1,v_comp_out);
comp_out := v_comp_out;
dbms_sql.close_cursor(source_cursor);
exception
when others
then if dbms_sql.is_open (source_cursor)
then dbms_sql.close_cursor (source_cursor);
end if;
raise;
END;
Can anybody help me?From the documentation which is worth reading
DBMS_SQL.DEFINE_COLUMN (c IN INTEGER,
position IN INTEGER,
column IN <datatype>)
Where <datatype> can be any one of the following types:
BINARY_DOUBLE
BINARY_FLOAT
BFILE
BLOB
CLOB CHARACTER SET ANY_CS
DATE
DSINTERVAL_UNCONSTRAINED
NUMBER
TIME_UNCONSTRAINED
TIME_TZ_UNCONSTRAINED
TIMESTAMP_LTZ_UNCONSTRAINED
TIMESTAMP_TZ_UNCONSTRAINED
TIMESTAMP_UNCONSTRAINED
UROWID
VARCHAR2 CHARACTER SET ANY_CS
YMINTERVAL_UNCONSTRAINEDSo you need a call more like:
dbms_sql.define_column(source_cursor, 1, dinf_027.cd_compilatore%type);because v_comp_out is not a datatype, it is a variable.
John -
MD5 PLS-00307: too many declarations of 'MD5' match this call
Hi I wonder if any one can help, I am trying to write an equlivent of mysqls MD5 function.
When I compile the following I get this error message:
PLS-00307: too many declarations of 'MD5' match this call
function MD5(str varchar2)
RETURN VARCHAR2 IS
md_str VARCHAR2(16);
BEGIN
md_str := dbms_obfuscation_toolkit.md5(str);
return md_str;
END;Looks to be like Oracle have bolloxed this one well and truly.
A desc of the toolkit reveals this:
PROCEDURE MD5
Argument Name Type In/Out Default?
INPUT RAW IN
CHECKSUM RAW(16) OUT
FUNCTION MD5 RETURNS RAW(16)
Argument Name Type In/Out Default?
INPUT RAW IN
PROCEDURE MD5
Argument Name Type In/Out Default?
INPUT_STRING VARCHAR2 IN
CHECKSUM_STRING VARCHAR2 OUT
FUNCTION MD5 RETURNS VARCHAR2(16)
Argument Name Type In/Out Default?
INPUT_STRING VARCHAR2 IN.
i.e. two overloaded functions and two overloaded procedures with exactly the same signature. This is not supposed to handle, because the signature (number and type of parameters) is how the database deteremines which version of teh function to call. Identical signatures causes your PLS-307 error.
If it's any consolation, they appear to have fixed it in Oracle 9i (there's a solitary MD5 procedure).
Cheers, APC -
PLS-00307: too many declarations of 'TO_CHAR' match this call
Hi,
I've got the error "PLS-00307: too many declarations of 'TO_CHAR' match this call" when I test to run a dynamic page portlet.
Someone helps?
Thanks.Hi,
What is the version of portal you are using? Also please give the code in the dynamic page.
Thanks,
Sharmila -
DBMS_SQL PLS-00307: too many declarations of 'PARSE' match this call
I try to accomplish the DDL in a program, i am here to ask the help in PLSQl since i have done very little. I did look up the oracle plsql docs though. Please do no ask the reaosn I have to do that in a program.
alter system kill session '<sid>, <serial#>';
sql> CREATE OR REPLACE PROCEDURE mykill(mysid IN NUMBER, myserial in number)
2 AS
3 cursor_name INTEGER;
4 rows_processed INTEGER;
5 BEGIN
6 cursor_name := dbms_sql.open_cursor;
7 DBMS_SQL.PARSE(cursor_name, 'ALTER SYSTEM KILL SESSION '':x', ':y''',
8 DBMS_SQL.NATIVE);
9 DBMS_SQL.BIND_VARIABLE(cursor_name, ':x', mysid);
10 DBMS_SQL.BIND_VARIABLE(cursor_name,':y', myserial);
11 rows_processed := DBMS_SQL.EXECUTE(cursor_name);
12 DBMS_SQL.CLOSE_CURSOR(cursor_name);
13 EXCEPTION
14 WHEN OTHERS THEN
15 DBMS_SQL.CLOSE_CURSOR(cursor_name);
16 END;
17 /
Warning: Procedure created with compilation errors.
sql> show error
Errors for PROCEDURE MYKILL:
LINE/COL ERROR
7/5 PL/SQL: Statement ignored
7/5 PLS-00307: too many declarations of 'PARSE' match this call
sql>SY, thanks
SQL> CREATE OR REPLACE
2 PROCEDURE mykill(
3 mysid IN NUMBER,
4 myserial in number
5 )
6 IS
7 BEGIN
8 EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || mysid || ',' || myserial || '''';
9 END;
10 /
Procedure created.
SQL> exec (541,1655);
BEGIN (541,1655); END;
ERROR at line 1:
ORA-06550: line 1, column 11:
PLS-00103: Encountered the symbol "," when expecting one of the following:
* & = - + < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec as between || multiset member submultisetplease advise. -
PLS-00307: too many declarations of 'FN_Myfunc' match this call
Dear all,
we have following two overloaded functions, we are facing issue while calling with exact case.
function FN_Myfunc( p_name IN OUT Varchar2,
P_DTLS IN OUT VARHCAR2) RETURN BOOLEAN;
function FN_Myfunc( p_name IN OUT CLOB,
P_DTLS IN OUT CLOB) RETURN BOOLEAN;
declare
l_name varchar2(50) default 'Name';
l_dtls varchar2(255);
begin
if( not FN_Myfunc(l_name,l_dtls)) then
log('errr');
end if;
end;
but the above call giving compilation error mentioned in the subject.
great full if we get instant reply.
Regards,
Paranthaman Rajendran.This resembles your problem:
Ask Tom &quot;ORA-06553: PLS-307 error&quot;
There's implicit conversion between varchar2 and clob. -
Too many declaration of 'DECODE' match this call
I am using Form 6i.
I have created cursor as follows :-
[html]
CURSOR cur_first IS SELECT item_description,
a.lot_no,
seq_no,
mis_no,
to_date(decode(warrenty_flag_yn, 'Y', warrenty_upto, 'N', '31-MAR-'||TO_CHAR(SYSDATE,'RRRR')),'dd-mm-rr'),
a.cpu_no
FROM pc_item_proc_hist_dtl a,
pc_item_procurement_history b,
pc_item_master c
WHERE a.item_code= b.item_code
AND a.lot_no = b.lot_no
AND a.item_code = c.item_code
AND (c.item_description LIKE '%'||:blk_main.item_name||'%' OR :blk_main.item_name IS NULL)
AND (a.lot_no = :blk_main.lot_no OR :blk_main.lot_no IS NULL)
AND (a.mis_no LIKE '%'|| :blk_main.mis_no|| '%' OR :blk_main.mis_no IS NULL)
AND (b.warrenty_upto BETWEEN :blk_main.from_date AND :blk_main.to_date)
ORDER BY c.item_description, SUBSTR(mis_no, INSTR(mis_no, '/', -1)+1);[html]
What to do for this problem? Anyone please suggest me.
Thanks and regards,
VikasSelect to_date(to_date may not throw an error, but it can cause data corruption:
SQL> alter session set nls_date_format = 'dd-mon-yy';
Session altered.
SQL> select to_char( to_date(to_date('01-jan-1801','dd-mon-yyyy')), 'dd-mon-yyyy' ) from dual;
TO_CHAR(TO_
01-jan-2001Note in the above sequence, 01-Jan-1801 gets converted to 01-Jan-2001.
That is because to_date(to_date causes Oracle to make a hidden conversion. The inner date returned by the inner to_date must be converted to CHARACTER first, before the outer to_date can be used. That conversion to character uses the default date format of DD-MON-YY, and therefore the century is lost.
Then the outer conversion adds the current century to the date when it converts the character data back to date.
So Vikas, it may work for dates in this century, but it fails everywhere else. -
Error 307: Too many declarations of "DECODE" match this call
Hi,
I'm unable to figure out the problem here with the DECODE thing...
My code as follows:
SELECT :KEYBLCK_JOB,
:ONE_UP_NO,
GJBPDFT_NUMBER,
SYSDATE,
DECODE(GJBPDFT_VALUE, 'SYSDATE', DECODE(GJBPDEF_LENGTH,
'11',TO_CHAR(SYSDATE,'DD-MON-YYYY'), SYSDATE),
GJBPDFT_VALUE)
FROM GJBPDFT G, GJBPDEFYou are using CHARACTER and DATE values at the same time in a DECODE:
TO_CHAR(SYSDATE,'DD-MON-YYYY')
or
SYSDATE
(and probably also NUMBER values for GJBPDEF_LENGTH?)
This may garble things up.
Edited by: InoL on Mar 15, 2011 3:30 PM -
Getting error PLS-00307: too many declarations while instantiating object.
Hi,
I'm using oracle 10.2.0.4.0
I've created an object obj_bsk as follows:
create or replace type obj_bsk as object
(batch_set_key varchar2(64),
constructor function obj_bsk
return self as result,
constructor function obj_bsk(p_batch_set_key in varchar2)
return self as result,
member procedure display_batch_set_key
and object body as
create or replace type body obj_bsk as
constructor function obj_bsk
return self as result is
begin
self.batch_set_key := sys_guid();
return;
end;
constructor function obj_bsk (p_batch_set_key varchar2)
return self as result is
begin
self.batch_set_key := p_batch_set_key;
return;
end;
member procedure display_batch_set_key is
begin
dbms_output.put_line('batch_set_key is:' || self.batch_set_key);
end;
end;
Then I've created a package test_obj as follows:
specification:
create or replace package test_obj is
-- Author : TSHARMA
-- Created : 31/01/2012 10:32:37
-- Purpose : to test objects
my_bsk obj_bsk;
g_batch_set_key varchar2(64);
procedure show_obj_val;
end test_obj;
body:
create or replace package body test_obj is
procedure show_obj_val is
begin
my_bsk.display_batch_set_key();
end;
begin
-- Initialization
if (g_batch_set_key is not null) then
my_bsk := obj_bsk(g_batch_set_key);
else
my_bsk := obj_bsk();
end if;
end test_obj;
When I'm compiling the package I'm getting following error:
Compilation errors for PACKAGE BODY TSHARMA.TEST_OBJ
Error: PLS-00307: too many declarations of 'OBJ_BSK' match this call
Line: 12
Text: my_bsk := obj_bsk(g_batch_set_key);
Error: PL/SQL: Statement ignored
Line: 12
Text: my_bsk := obj_bsk(g_batch_set_key);
Can anyone please explain why oracle is viewing it as too many call for constructor when both constructors are different.
and how to resolve the issue.
Thanks
TarunI've solved the problem. Though it is strange.
The error occurred because I'm using p_batch_set_key as parameter constructor.
i.e. constructor function obj_bsk(p_batch_set_key in varchar2)
return self as result,
once I changed it to the same name as variable name in object it compiled fine.
i.e constructor function obj_bsk(batch_set_key in varchar2)
return self as result,
It is very strange. Can anyone plesae explain why the parameter name should be same as variable name in object.
Thanks
Tarun -
Calling Overloaded Procedures from Table Adapter - PLS-00307: too many..
I have called Overloaded Oracle Procs in .NET code in the past. I now want to add a procedure call to a table adapter. The proc is an overloaded proc and when I add it I get the following:
PLS-00307: too many declarations of 'prc_[my proc name]' match this call.
I looked in the designer class and all the parameters are there, just as I do in my own code, but it still gets the message above even with all the parameter names in place.
Is there a way to call Overloaded Procs from a table adapter? ?Any Oracle folks care to provide some input on why Table Adapters cannot call Overloaded Stored Procs?
Edited by: SURFThru on Jul 8, 2011 11:37 AM -
Too many declarations of '+' match this call ,, help me
i have put a pre insert trigger on my block level to take max value of id and increase + 1 to it to generate a new id
here is my code
declare
max_SYSid PT_EMP_DOCUMENT_HEAD.EDH_SYS_ID%TYPE;
begin
select max(EDH_SYS_ID) into max_SYSid from PT_EMP_DOCUMENT_HEAD;
max_SYSid := max_SYSid + 1;
message ('The New SYS id is :'||to_char(max_SYSid ));
:PT_EMP_DOCUMENT_HEAD.EDH_SYS_ID := max_SYSid ;
end;
declare
max_docno PT_EMP_DOCUMENT_HEAD.EDH_DOC_NO%TYPE;
begin
select max(EDH_DOC_NO) into max_docno from PT_EMP_DOCUMENT_HEAD;
max_docno := max_docno + 1;
message ('The New Doc. NO is :'||to_char(max_docno));
:PT_EMP_DOCUMENT_HEAD.EDH_DOC_NO := max_docno ;
end;but while complie it it give me an error which says
too many declarations of '+' match this call,
too many declarations of 'to_char' match this call,
, can any one help me ?declare
max_docno PT_EMP_DOCUMENT_HEAD.EDH_DOC_NO%TYPE;
l_docno number;
begin
select max(EDH_DOC_NO) into l_docno from PT_EMP_DOCUMENT_HEAD;
l_docno := l_docno + 1;
message ('The New Doc. NO is :'||to_char(l_docno));
:PT_EMP_DOCUMENT_HEAD.EDH_DOC_NO := to_char(l_docno) ;
end;something like that should do the trick .. -
-1 interleaved_vacations(p_emp_no in varchar2 ,
p_start_date in date,
p_end_date in date,
p_rowid varchar );
2- interleaved_vacations(p_emp_no in varchar2 ,
p_start_date in date default null ,
p_end_date in date default null,
p_submission_id in number)
i have 2 these functions declared in same pakage, when i use second function in forms there isn't any problem but when i use the first function in another form give me this message "Error 307 too many declarations of " interleaved_vacations" match this call"
plz help meDid you try binding the variables in forns: eg
nterleaved_vacations(p_emp_no =>'test',
p_start_date => :start_date,
p_end_date =>: end_date,
p_rowid => :block.rowid ); -
Overloading a DATE function with TIMESTAMP to avoid "too many declarations"
CREATE OR REPLACE PACKAGE util
AS
FUNCTION yn (bool IN BOOLEAN)
RETURN CHAR;
FUNCTION is_same(a varchar2, b varchar2)
RETURN BOOLEAN;
FUNCTION is_same(a date, b date)
RETURN BOOLEAN;
/* Oracle's documentation says that you cannot overload subprograms
* that have the same type family for the arguments. But,
* apparently timestamp and date are in different type families,
* even though Oracle's documentation says they are in the same one.
* If we don't create a specific overloaded function for timestamp,
* and for timestamp with time zone, we get "too many declarations
* of is_same match" when we try to call is_same for timestamps.
FUNCTION is_same(a timestamp, b timestamp)
RETURN BOOLEAN;
FUNCTION is_same(a timestamp with time zone, b timestamp with time zone)
RETURN BOOLEAN;
/* These two do indeed cause problems, although there are no errors when we compile the package. Why no errors here? */
FUNCTION is_same(a integer, b integer) return boolean;
FUNCTION is_same(a real, b real) return boolean;
END util;
CREATE OR REPLACE PACKAGE BODY util
AS
NAME: yn
PURPOSE: pass in a boolean, get back a Y or N
FUNCTION yn (bool IN BOOLEAN)
RETURN CHAR
IS
BEGIN
IF bool
THEN
RETURN 'Y';
END IF;
RETURN 'N';
END yn;
NAME: is_same
PURPOSE: pass in two values, get back a boolean indicating whether they are
the same. Two nulls = true with this function.
FUNCTION is_same(a in varchar2, b in varchar2)
RETURN BOOLEAN
IS
bool boolean := false;
BEGIN
IF a IS NULL and b IS NULL THEN bool := true;
-- explicitly set this to false if exactly one arg is null
ELSIF a is NULL or b IS NULL then bool := false;
ELSE bool := a = b;
END IF;
RETURN bool;
END is_same;
FUNCTION is_same(a in date, b in date)
RETURN BOOLEAN
IS
bool boolean := false;
BEGIN
IF a IS NULL and b IS NULL THEN bool := true;
-- explicitly set this to false if exactly one arg is null
ELSIF a is NULL or b IS NULL then bool := false;
ELSE bool := a = b;
END IF;
RETURN bool;
END is_same;
FUNCTION is_same(a in timestamp, b in timestamp)
RETURN BOOLEAN
IS
bool boolean := false;
BEGIN
IF a IS NULL and b IS NULL THEN bool := true;
-- explicitly set this to false if exactly one arg is null
ELSIF a is NULL or b IS NULL then bool := false;
ELSE bool := a = b;
END IF;
RETURN bool;
END is_same;
FUNCTION is_same(a in timestamp with time zone, b in timestamp with time zone)
RETURN BOOLEAN
IS
bool boolean := false;
BEGIN
IF a IS NULL and b IS NULL THEN bool := true;
-- explicitly set this to false if exactly one arg is null
ELSIF a is NULL or b IS NULL then bool := false;
ELSE bool := a = b;
END IF;
RETURN bool;
END is_same;
/* Don't bother to fully implement these two, as they'll just cause errors at run time anyway */
FUNCTION is_same(a integer, b integer) return boolean is begin return false; end;
FUNCTION is_same(a real, b real) return boolean is begin return false; end;
END util;
declare
d1 date := timestamp '2011-02-15 13:14:15';
d2 date;
t timestamp := timestamp '2011-02-15 13:14:15';
t2 timestamp;
a varchar2(10);
n real := 1;
n2 real;
begin
dbms_output.put_line('dates');
dbms_output.put_line(util.yn(util.is_same(d2,d2) ));
dbms_output.put_line(util.yn(util.is_same(d1,d2) ));
dbms_output.put_line('timestamps'); -- why don't these throw exception?
dbms_output.put_line(util.yn(util.is_same(t2,t2) ));
dbms_output.put_line(util.yn(util.is_same(t,t2) ));
dbms_output.put_line('varchars');
dbms_output.put_line(util.yn(util.is_same(a,a)));
dbms_output.put_line(util.yn(util.is_same(a,'a')));
dbms_output.put_line('numbers');
-- dbms_output.put_line(util.yn(util.is_same(n,n2))); -- this would throw an exception
end;
/Originally, I had just the one function with VARCHAR2 arguments. This failed to work properly because when dates were passed in, the automatic conversion to VARCHAR2 was dropping the timestamp. So, I added a 2nd function with DATE arguments. Then I started getting "too many declarations of is_same exist" error when passing TIMESTAMPs. This made no sense to me, so even though Oracle's documentation says you cannot do it, I created a 3rd version of the function, to handle TIMESTAMPS explicitly. Surprisingly, it works fine. But then I noticed it didn't work with TIMESTAMP with TIME ZONEs. Hence, the fourth version of the function. Oracle's docs say that if your arguments are of the same type family, you cannot create an overloaded function, but as the example above shows, this is very wrong.
Lastly, just for grins, I created the two number functions, one with NUMBER, the other with REAL, and even these are allowed - they compile. But then at run time, it fails. I'm really confused.
Here is the apparently incorrect Oracle documentation on the matter: http://docs.oracle.com/cd/B12037_01/appdev.101/b10807/08_subs.htm (see overloading subprogram names), and here are the various types and their families: http://docs.oracle.com/cd/E11882_01/appdev.112/e17126/predefined.htm.
Edited by: hotwater on Jan 9, 2013 3:38 PM
Edited by: hotwater on Jan 9, 2013 3:46 PM>
So, I added a 2nd function with DATE arguments. Then I started getting "too many declarations of is_same exist" error when passing TIMESTAMPs. This made no sense to me
>
That is because when you pass a TIMESTAMP Oracle cannot determine whether to implicitly convert it to VARCHAR2 and use your first function or implicitly convert it to DATE and use your second function. Hence the 'too many declarations' exist error.
>
, so even though Oracle's documentation says you cannot do it, I created a 3rd version of the function, to handle TIMESTAMPS explicitly. Surprisingly, it works fine. But then I noticed it didn't work with TIMESTAMP with TIME ZONEs.
>
Possibly because of another 'too many declarations' error? Because now there would be THREE possible implicit conversions that could be done.
>
Hence, the fourth version of the function. Oracle's docs say that if your arguments are of the same type family, you cannot create an overloaded function, but as the example above shows, this is very wrong.
>
I think the documentation, for the 'date' family, is wrong as you suggest. For INTEGER and REAL the issue is that those are ANSI data types and are really the same Oracle datatype; they are more like 'aliases' than different datatypes.
See the SQL Language doc
>
ANSI, DB2, and SQL/DS Datatypes
SQL statements that create tables and clusters can also use ANSI datatypes and datatypes from the IBM products SQL/DS and DB2. Oracle recognizes the ANSI or IBM datatype name that differs from the Oracle Database datatype name. It converts the datatype to the equivalent Oracle datatype, records the Oracle datatype as the name of the column datatype, and stores the column data in the Oracle datatype based on the conversions shown in the tables that follow.
INTEGER
INT
SMALLINT
NUMBER(38)
FLOAT (Note b)
DOUBLE PRECISION (Note c)
REAL (Note d)
FLOAT(126)
FLOAT(126)
FLOAT(63) -
F110 -Too many payment mediums created for this payment group
Hello Gurus,
Am getting below error after executing payment run F110.
BFIBL02160 Too many payment mediums created for this payment group
BFIBL02616 End of log for payment run 20140409 / DPA04 , PE1 / 500
We are not able to see the Payment advice note in the spool request.
Can you please share your ideas to resolve the issue
Thanks in advacneHI,
Please let us know for account like vendor , customer you running the payment advice.
check if the customer ,vendor document is posted or not.
which customer, vendor number you had maintained in the f110 .
check that before you run it.
else.. create new document and start run the payment.
for single document fi you try more than once it will give the above error.
and also the check the program and variant as well.
let me know any corrections.
thanks.
Maybe you are looking for
-
IPad2 reboots every few minutes
My iPad2 recently began to reboot every few minutes of use. It has been reformatted, all added apps removed and the battery allowed to completely deplete then recharge, all to no avail. Any suggestions?
-
Can't Uninstall Parallels Desktop, Need Help.
I have stopped using Parallels Desktop and decided to uninstall it using the provided uninstaller. This however didn't get rid of the Kernel service so I used the sudo commands they say to use. However this still did not get rid of the services that
-
hi. i have break the screen of my iphone 4.If i want to by a regenerated iphone 4, how much it cost?thanks a lot. see you soon. Luca
-
No automatic iPhone pics --- iPhoto
As of today, I've done an Erase and Reinstall of OS 10.4 as well as a restore on the iPhone, and I can not regain a feature I had when I first purchased this iPhone. I would like camera pics from the iPhone to be automatically sent to the computer wh
-
Additional Calendar Event Alert Options
For about 1/3 of the Calendar Events that I set, I am used to setting an alert for an event up to one week prior. Then, when the alert happens, I edit the Event and change the reminder to occur from 1 to 6 days before. Usually the day before I change