ORA-06503 Function returned without value
Hi All,
I'm getting ORA-06503: PL/SQL: Function returned without value error on this function..... can u guide me where Im going wrong?
Cheers!
I
FUNCTION XX(P_Trial_No IN PATIENT_VISITS.TRIAL_NO%TYPE,
P_PATIENT_VISIT_NO IN PATIENT_VISITS.PATIENT_VISIT_NO%TYPE) RETURN NUMBER IS
L_Sequence_No Patient_Visit_Designs.Sequence_No%TYPE;
BEGIN
-- Retrieves and returns sequence Number from patient visit designs
IF p_patient_visit_no IS NOT NULL THEN
SELECT Sequence_No
INTO L_Sequence_No
FROM Patient_Visit_Designs pvd
WHERE pvd.Trial_No = P_Trial_No AND
pvd.Patient_Visit_No = P_Patient_Visit_No;
RETURN L_Sequence_No;
ELSE
RETURN NULL;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
END XX;
CREATE OR REPLACE FUNCTION xx (
p_trial_no IN patient_visits.trial_no%TYPE,
p_patient_visit_no IN patient_visits.patient_visit_no%TYPE
RETURN NUMBER
IS
l_sequence_no patient_visit_designs.sequence_no%TYPE;
BEGIN
l_sequence_no := NULL;
-- Retrieves and returns sequence Number from patient visit designs
BEGIN
IF p_patient_visit_no IS NOT NULL
THEN
SELECT sequence_no
INTO l_sequence_no
FROM patient_visit_designs pvd
WHERE pvd.trial_no = p_trial_no
AND pvd.patient_visit_no = p_patient_visit_no;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_sequence_no := NULL;
END;
RETURN l_sequence_no;
END xx;
Similar Messages
-
ORA-06503: Function returned without value at WWV_FLOW_WEBSERVICES_API
Hi, I use APEX_WEB_SERVICE.MAKE_REQUEST function to call web service however stuck with ORA-06503 exception. It would be nice to hear comment from someone who knows APEX_WEB_SERVICE from inside.
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "APEX_040000.WWV_FLOW_WEBSERVICES_API", line 125
ORA-06512: at "NEC_VLD.NEC_DVS_WS", line 77
The error occurs about 60% of my test case calls and always with the same parameter values. I thought something bad on web service side however I've tested it with the same parameter values on SoapUI tool and it works just fine. The parameter itself is fixed length varchar2 variable (e.g. 636BB6EFF19941420F00010000007B00000000000000).
My environments
APEX
4.0.1 - no luck
upgrade to 4.0.2 - no luck
plain 4.0.2 install - no luck
Databases
10.0.2
11.0.2
Procedure to call web service:
procedure getDocumentByID(
p_xhdoc in varchar2) is
l_envelope clob;
l_resp_msg XMLType;
begin
l_envelope := '<?xml version="1.0" encoding="UTF-8"?>';
l_envelope := l_envelope||'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sap="http://saperion.dvs.affecto.lt/">
<soapenv:Header/>
<soapenv:Body>
<sap:getDocumentByID>
<id>'||p_xhdoc||'</id>
</sap:getDocumentByID>
</soapenv:Body>
</soapenv:Envelope>';
l_resp_msg := apex_web_service.make_request(
p_url => get_ref_value('DVS_DOC_WS_URL'),
p_action => get_ref_value('DVS_DOC_WS_ACTION'),
p_envelope => l_envelope,
p_username => null,
p_password => null);
end;
Regards,
TomasNever mind sorry! I've just tried granting APEX_040000 permissions for this particular Network ACL and now it works! Can I suggest that apex_web_service.make_request needs some better error handling however.
Here's the fix...
BEGIN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
acl => 'mywebservice.xml'
, principal => 'APEX_040000'
, is_grant => TRUE
, privilege => 'connect'
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
acl => 'mywebservice.xml'
, principal => 'APEX_040000'
, is_grant => TRUE
, privilege => 'resolve'
COMMIT;
END; -
ORA-06503: PL/SQL: Function returned without value
Hello
Having a bit of a problem with piplined functions.
Why does this work :
SET SERVEROUTPUT ON
DECLARE
TYPE SARRAY IS TABLE OF VARCHAR2(4000);
CURSOR CU IS SELECT * FROM DX_XML_ATTENDANCE WHERE STUD_ID = 107777 AND BASE_ID = 94;
T_STUD NUMBER(10);
T_BASE NUMBER(10);
T_DATE DATE;
T_MARKS VARCHAR2(1000);
LEN_MARKS NUMBER;
PDATE DATE;
SDATE DATE;
EDATE DATE;
SLEN NUMBER;
WEEKLEN NUMBER;
INIPOS NUMBER;
MARRAY VARCHAR2(1000);
SUBARRAY SARRAY := SARRAY();
SFILL VARCHAR2(14) := '--------------';
EPOS NUMBER;
MY_REC DX_XML_ATTENDANCE%ROWTYPE;
BEGIN
SUBARRAY.EXTEND(17);
DBMS_OUTPUT.ENABLE(100000000);
--FOR MY_REC IN CU
OPEN CU;
LOOP
FETCH CU INTO MY_REC;
EXIT WHEN (CU%NOTFOUND);
T_STUD := MY_REC.STUD_ID;
T_BASE := MY_REC.BASE_ID;
T_DATE := TO_DATE(MY_REC.START_DATE, 'DD/MM/YYYY');
T_MARKS := MY_REC.MARKS;
LEN_MARKS := LENGTH(T_MARKS);
EPOS := LEN_MARKS / 2;
SDATE := ROUND(TO_DATE(T_DATE), 'W') - 1;
INIPOS := TO_NUMBER(TO_CHAR(T_DATE, 'D'));
SLEN := INIPOS + 3;
PDATE := SDATE;
EDATE := SDATE + EPOS;
MARRAY := SUBSTR(T_MARKS, 1, SLEN);
WEEKLEN := LENGTH(MARRAY);
IF WEEKLEN < 14 THEN
MARRAY := SUBSTR(SFILL, 1, 14 - WEEKLEN) || MARRAY;
END IF;
SUBARRAY(1) := T_STUD;
SUBARRAY(2) := T_BASE;
SUBARRAY(3) := PDATE;
FOR i IN 4 .. 17 LOOP
SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
END LOOP;
DBMS_OUTPUT.PUT_LINE(SUBARRAY(1)||' '||SUBARRAY(2)||' '||SUBARRAY(3)||' '||SUBARRAY(4)||' '||
SUBARRAY(5)||' '||SUBARRAY(6)||' '||SUBARRAY(7)||' '||SUBARRAY(8)||' '||SUBARRAY(9)||' '||
SUBARRAY(10)||' '||SUBARRAY(11)||' '||SUBARRAY(12)||' '||SUBARRAY(13)||' '||SUBARRAY(14)||' '||
SUBARRAY(15)||' '||SUBARRAY(16)||' '||SUBARRAY(17));
WHILE PDATE < EDATE LOOP
PDATE := PDATE + 7;
MARRAY := SUBSTR(T_MARKS, SLEN + 1, 14);
WEEKLEN := LENGTH(MARRAY);
IF WEEKLEN < 14 THEN
MARRAY := MARRAY || SUBSTR(SFILL, 1, 14 - WEEKLEN);
END IF;
FOR i IN 4 .. 17 LOOP
SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
END LOOP;
SUBARRAY(3) := PDATE;
DBMS_OUTPUT.PUT_LINE(SUBARRAY(1)||' '||SUBARRAY(2)||' '||SUBARRAY(3)||' '||SUBARRAY(4)||' '||
SUBARRAY(5)||' '||SUBARRAY(6)||' '||SUBARRAY(7)||' '||SUBARRAY(8)||' '||SUBARRAY(9)||' '||
SUBARRAY(10)||' '||SUBARRAY(11)||' '||SUBARRAY(12)||' '||SUBARRAY(13)||' '||SUBARRAY(14)||' '||
SUBARRAY(15)||' '||SUBARRAY(16)||' '||SUBARRAY(17));
PDATE := PDATE + 7;
SLEN := SLEN + 14;
END LOOP;
END LOOP;
END;
and this does not :
CREATE OR REPLACE PACKAGE BODY PARSE_ATTENDANCE AS
FUNCTION ENUM_MARKS(SEL_SQL IN VARCHAR2)
RETURN TMP_ATT_DATA_TBL PIPELINED
IS
V_SQL VARCHAR(1000):= SEL_SQL;
V_CURSOR SYS_REFCURSOR;
V_ROW TMP_ATT_HOLDING:=TMP_ATT_HOLDING(NULL, NULL, NULL, NULL);
T_STUD NUMBER(10);
T_BASE NUMBER(10);
T_DATE DATE;
T_MARKS VARCHAR2(1000);
LEN_MARKS NUMBER;
PDATE DATE;
SDATE DATE;
EDATE DATE;
SLEN NUMBER;
WEEKLEN NUMBER;
INIPOS NUMBER;
MARRAY VARCHAR2(1000);
SUBARRAY SARRAY := SARRAY();
SFILL VARCHAR2(14) := '--------------';
EPOS NUMBER;
BEGIN
SUBARRAY.EXTEND(17);
OPEN V_CURSOR FOR V_SQL;
LOOP
FETCH V_CURSOR INTO V_ROW.STUD_ID, V_ROW.BASE_ID, V_ROW.START_DATE, V_ROW.MARKS;
EXIT WHEN V_CURSOR%NOTFOUND;
T_STUD := V_ROW.STUD_ID;
T_BASE := V_ROW.BASE_ID;
T_DATE := TO_DATE(V_ROW.START_DATE, 'DD/MM/YYYY');
T_MARKS := V_ROW.MARKS;
LEN_MARKS := LENGTH(T_MARKS);
EPOS := LEN_MARKS / 2;
SDATE := ROUND(TO_DATE(T_DATE), 'W') - 1;
INIPOS := TO_NUMBER(TO_CHAR(T_DATE, 'D'));
SLEN := INIPOS + 3;
PDATE := SDATE;
EDATE := SDATE + EPOS;
MARRAY := SUBSTR(T_MARKS, 1, SLEN);
WEEKLEN := LENGTH(MARRAY);
IF WEEKLEN < 14 THEN
MARRAY := SUBSTR(SFILL, 1, 14 - WEEKLEN) || MARRAY;
END IF;
SUBARRAY(1) := T_STUD;
SUBARRAY(2) := T_BASE;
SUBARRAY(3) := PDATE;
FOR i IN 4 .. 17 LOOP
SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
END LOOP;
PIPE ROW(TMP_ATT_DATA_OBJ(SUBARRAY(1),SUBARRAY(2),SUBARRAY(3),SUBARRAY(4),
SUBARRAY(5),SUBARRAY(6),SUBARRAY(7),SUBARRAY(8),SUBARRAY(9),
SUBARRAY(10),SUBARRAY(11),SUBARRAY(12),SUBARRAY(13),SUBARRAY(14),
SUBARRAY(15),SUBARRAY(16),SUBARRAY(17)));
WHILE PDATE < EDATE LOOP
PDATE := PDATE + 7;
MARRAY := SUBSTR(T_MARKS, SLEN + 1, 14);
WEEKLEN := LENGTH(MARRAY);
IF WEEKLEN < 14 THEN
MARRAY := MARRAY || SUBSTR(SFILL, 1, 14 - WEEKLEN);
END IF;
FOR i IN 4 .. 17 LOOP
SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
END LOOP;
SUBARRAY(3) := PDATE;
PIPE ROW(TMP_ATT_DATA_OBJ(SUBARRAY(1),SUBARRAY(2),SUBARRAY(3),SUBARRAY(4),
SUBARRAY(5),SUBARRAY(6),SUBARRAY(7),SUBARRAY(8),SUBARRAY(9),
SUBARRAY(10),SUBARRAY(11),SUBARRAY(12),SUBARRAY(13),SUBARRAY(14),
SUBARRAY(15),SUBARRAY(16),SUBARRAY(17)));
PDATE := PDATE + 7;
SLEN := SLEN + 14;
END LOOP;
END LOOP;
END ENUM_MARKS;
END PARSE_ATTENDANCE;
(This is then called like SELECT * FROM
TABLE(
PARSE_ATTENDANCE.ENUM_MARKS(
'SELECT STUD_ID, BASE_ID, START_DATE, MARKS
FROM DX_XML_ATTENDANCE WHERE STUD_ID = 107777
AND BASE_ID = 94'))
I get the same error, around this section near the bottom :
PDATE := PDATE + 7;
SLEN := SLEN + 14;
Can any one help?Here is an example. you are missing an return statement.
SQL> create or replace type varchar2_table is table of varchar2(10) ;
2 /
Type created.
SQL> show errors
No errors.
SQL> create or replace function get_data return varchar2_table pipelined is
2 begin
3 pipe row(('Test')) ;
4 end ;
5 /
Function created.
SQL> show errors
No errors.
SQL> select * from table(get_data) ;
ERROR:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "KKISHORE.GET_DATA", line 3
no rows selected
SQL> create or replace function get_data return varchar2_table pipelined is
2 begin
3 pipe row(('Test')) ;
4 return ;
5 end ;
6 /
Function created.
SQL> show errors
No errors.
SQL> select * from table(get_data) ;
COLUMN_VAL
Test
SQL> -
PL/SQL: Function returned without value in authentication schemes
Hi all,
finally i did the authentication shemes based on my function and my own table ,thank you all for help :-) ,but now when i enter
1-correct user name &wrong password <it is gonna work,the authentication workin fine >
i am gonna get <Invalid Login Credentials> which is right in case of wrong login
2-wrong user name &wrong password <it is not gonna work>
3-wrong user name &correct password <it not gonna work>
in case of not working i am getting the following error:
ORA-06503: PL/SQL: Function returned without value
Error ERR-10460 Unable to run authentication credential check function.
any help to solve this issue so that it will display <Invalid Login Credentials>
in all cases of invalid login
thanks in advance ,
Ahmed,scott,you efforts was useful and i beleive that the error that i am getting it is from the function that i have can you please take a look on :
FUNCTION CHECK_USER
( P_USERNAME IN varchar2,
P_PASSWORD IN varchar2)
RETURN boolean
IS
BEGIN
for c1 in (select user_name, password from vms2_employee_details where user_name = P_USERNAME)
loop
if P_PASSWORD = c1.password then
return true;
------dbms_output.put_line('the return from the function is true');
else
return false;
----dbms_output.put_line('the return from the function is false');
end if;
end loop;
EXCEPTION
WHEN no_data_found THEN
return false;
when others then
return false;
----dbms_output.put_line('the return from the function is false');
END;
and tell me what do you think ,
thanks,
ahmed -
Problem with Function returned without value -
all i am having a problem w/ jdev passing the values. when hardcoded it works. when i remove to pass the 2 vals for doc_type and doc_num the params are being passed to the impl but the String sql = " BEGIN :5 := scotts_test_proc.get_log(:1, :2, :3, :4 ); END; "; is not sending the values to the pkg. to verify i am getting data i created a table to store the data being passed/retrieved by function. i am getting the log_pieces posted when hard coded so i know that works. but when i try to pass the doc_type and doc_num it errors w/ function returend without value . am i passing the params correctly from co to impl to func to get the return l0g_piece. thats for the help
calling package
spec
function Get_Log( -- rmode IN NUMBER , rmode IN STRING, doc_type IN VARCHAR2 DEFAULT 'TEL',
doc_id IN VARCHAR2 DEFAULT NULL , doc_num IN VARCHAR2 DEFAULT NULL
-- , p_out out varchar2
) -- IS --proc
RETURN varchar2 IS --function
body
l_doc_type := 'TEL';- remove this hardcoded
l_doc_type := doc_type ; --to pass the param
IF l_doc_type = 'TEL' THEN
-- l_log_pieces := Get_TEL(TRIM(3524204)); --change 3524204 to doc_num hardcoded presently
l_log_pieces := Get_TEL(TRIM(doc_num)); --to pass the param
-- (doc_num);
l_log_piece := l_log_pieces(1);
-- p_out := l_log_piece ;
insert into isitthere (doc_type, doc_num, isitthere) VALUES (doc_type, doc_num, l_log_piece); commit;
return l_log_piece; -- function -- return p_out; -- function p_out := l_log_piece ; proc
END IF; --if doc type is TEL
FROM CO
System.out.println("CO Passing paramDOC_TYPE for -------> " +docAbbr.getValue(pageContext) ); -- passing TEL
System.out.println("CO Passing paramDOC_NUM for -------> " + paramDOC_NUM ); -- passing 88
String getDocAbbrForHTML = docAbbr.getText(pageContext);
System.out.println("Passing CO getDocAbbrForHTML for -------> " + getDocAbbrForHTML ); -- passing TEL
Serializable paramDocLocatorParamList [] = {paramRMODE, getDocAbbrForHTML , paramDOC_ID, paramDOC_NUM , p_out };
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OADBTransaction dbtrans;
OAViewObject docLocator = (OAViewObject)am.findViewObject("DocLocatorVO1");
Serializable paramABC = "TELNET";
paramABC = am.invokeMethod("getHTMLString", paramDocLocatorParamList);
rtxt0.setValue(pageContext, "here it is 12354" + paramABC.toString() );
// docLocator.executeQuery();
// --------------- End getHTMLString ----------------- //
FROM AM IMPL
public String getHTMLString ( String paramRMODE, String getDocAbbrForHTML , String paramDOC_ID, String paramDOC_NUM, String p_out )
System.out.println("Entering The AM Impl");
System.out.println("Passing getDocAbbrForHTML in IMPL -------> " +getDocAbbrForHTML ); -- got TEL in param
System.out.println("Passing paramDOC_NUM in IMPL -------> " + paramDOC_NUM ); -- got 88 in param
CallableStatement st = null;
OADBTransaction txn = (OADBTransaction)getDBTransaction();
Connection conn = txn.getJdbcConnection();
String sql = " BEGIN :5 := scotts_test_proc.get_log(:1, :2, :3, :4 ); END; ";
CallableStatement cs = txn.createCallableStatement(sql,1);
String ErrorExist = "";
String getHTML = "";
try
cs.setString(1, paramRMODE); // cs.setInt(1, paramRMODE.intValue()); // cs.setInt(1,Integer.parseInt(paramRMODE));
cs.setString(2, getDocAbbrForHTML); //paramDOC_TYPE);
cs.setString(3, paramDOC_ID);
cs.setString(4, paramDOC_NUM);
// cs.setString(5,p_out); // --param
/* cs.registerOutParameter(1,Types.CHAR);
cs.registerOutParameter(2,Types.CHAR);
cs.registerOutParameter(3,Types.CHAR);
cs.registerOutParameter(4,Types.CHAR);*/
cs.registerOutParameter(5,Types.VARCHAR);
cs.execute();
getHTML = cs.getString(5 ) ;
p_out = getHTML;
//this string is to see my results. only......
String x ="abc 123";/*"<BR><font face=Verdana ><b>TEL Document Action History <BR><font color=#336699>(3524204 Nosulina, Yelena N COMPLETE)</b></font></font><br><br><table border=1 width=100% cellspacing=0 cellpadding=2 bordercolor=#EEEEDC> <tr bgcolor=#F7F7E7>"
+ " <td width=11% valign=top align=left><font face=Verdana size=2 color=#336699><b>Action</b></font></td> <td width=17% valign=top align=left ><font face=Verdana size=2 color=#336699><b>Approver UserName</b></font></td> <td width=14% valign=top align=left ><font face=Verdana size=2 color=#336699><b>Date/Time </b></font></td> <td width=56% valign=top align=left ><font face=Verdana size=2 color=#336699><b>Notes</b></font></td> "
+" </tr> <!-- loop thru this set of rows ---> <tr bgcolor=#FFFFFF> <td width=11% valign=top align=left ><font face=Verdana size=2 > </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2> </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Dec-20-2011 03:01:23 PM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>DOCUMENT CREATED </font></td> </tr> <!-- end loop--> "
+ " <tr bgcolor=#FFFFFF> <td width=11% valign=top align=left ><font face=Verdana size=2 > </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2>McCombs, Tracey L </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Dec-30-2011 01:12:10 PM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>Requestor </font></td> </tr> <!-- end loop--> <tr bgcolor=#FFFFFF> "
+" <td width=11% valign=top align=left ><font face=Verdana size=2 >WF STARTED </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2>Workflow </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Dec-30-2011 01:12:21 PM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>Workflow Started </font></td> </tr> <!-- end loop--> <tr bgcolor=#FFFFFF> "
+"<td width=11% valign=top align=left ><font face=Verdana size=2 > </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2>McCombs, Tracey L </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Dec-30-2011 01:12:21 PM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>SUBMIT </font></td> </tr> <!-- end loop--> <tr bgcolor=#FFFFFF> "
+"<td width=11% valign=top align=left ><font face=Verdana size=2 >NOTIFICATION SENT </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2>Workflow </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Dec-30-2011 01:12:21 PM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>Notification sent to User Approvals Level 1, Org ID: 455 311402400 Med - Infectious Diseases </font></td> "
+" </tr> <!-- end loop--> <tr bgcolor=#FFFFFF> <td width=11% valign=top align=left ><font face=Verdana size=2 > </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2>Brownlow, Lana Jill </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Jan-03-2012 08:49:48 AM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>Approved : </font></td> </tr> <!-- end loop--> <tr bgcolor=#FFFFFF> "
+" <td width=11% valign=top align=left ><font face=Verdana size=2 >USER APPROVED </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2>Workflow </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Jan-03-2012 08:49:48 AM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>Completed all User Approvals </font></td> </tr> <!-- end loop--> <tr bgcolor=#FFFFFF> "
+ " <td width=11% valign=top align=left ><font face=Verdana size=2 >CENTRAL APPROVED </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2> </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Jan-03-2012 08:49:48 AM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>Completed Central Approval Process </font></td> </tr> <!-- end loop--> <tr bgcolor=#FFFFFF> "
+" <td width=11% valign=top align=left ><font face=Verdana size=2 > </font></td> <td width=17% valign=top align=left ><font face=Verdana size=2> </font></td> <td width=14% valign=top align=left ><font face=Verdana size=2>Jan-03-2012 02:17:07 PM </font></td> <td width=56% valign=top align=left ><font face=Verdana size=2>DOCUMENT REASON CHANGED TO COMPLETE. DATA LOADED IN BASE TABLES. </font></td> </tr> <!-- end loop--></table>";
getHTML = x;
System.out.println("getHTML 1234 is " + getHTML ); -- testing output to get returned
cs.close();
catch (SQLException sqle)
try { cs.close(); }
catch (Exception e) {}
throw OAException.wrapperException(sqle);
return getHTML;when return is encountered your function terminates.
-
Function returned without value Error
create or replace function dssppv.hra_find_short_path (
p_new_rgmn_grp_gid in number
,p_tail_rgmn_grp_gid in number
,p_mkt_cnfgr_gid in number
return string
is
v_rgmn_grp_path varchar2 ( 2000 );
check_step varchar2 ( 2000 );
begin
dbms_output.put_line
( 'Begin of function hra_find_short_path to Check Circular Loop : '
|| to_char ( sysdate, 'YYYY-MM-DD HH24:MI:SS' )
check_step := ' Step 1 - Circular loop Check up.';
--Checking for the circular loop
select rgmn_path || '/' || gt.rgmn_grp_nam
into v_rgmn_grp_path
from ( select min_rgmn_node
,rgmn_path
,rgmn_grp_gid
from ( select level as min_rgmn_node
,dt.rgmn_grp_gid
,dt.tail_rgmn_grp_gid
,gp.rgmn_grp_nam
,rtrim
( reverse
( sys_connect_by_path
( reverse ( gp.rgmn_grp_nam )
) as rgmn_path
from dssppv.t_market_cnfgr_rgmn_grp_dtl dt join dssppv.t_market_cnfgr_rgmn_grp gp
on ( dt.rgmn_grp_gid = gp.rgmn_grp_gid
and gp.mkt_cnfgr_gid = p_mkt_cnfgr_gid
start with dt.tail_rgmn_grp_gid = p_new_rgmn_grp_gid
connect by nocycle prior dt.rgmn_grp_gid =
dt.tail_rgmn_grp_gid )
where rgmn_grp_gid = p_tail_rgmn_grp_gid
order by min_rgmn_node )
,dssppv.t_market_cnfgr_rgmn_grp gt
where gt.rgmn_grp_gid = p_new_rgmn_grp_gid and rownum = 1;
dbms_output.put_line ( ' Circular Loop is formed as shown :'
|| v_rgmn_grp_path
if ( v_rgmn_grp_path is not null )
then
dbms_output.put_line ( ' Circular Loop is formed as shown :'
|| v_rgmn_grp_path
else
dbms_output.put_line ( ' No Loop is formed.' );
end if;
dbms_output.put_line
( 'End of function hra_find_short_path to Check Circular Loop : '
|| to_char ( sysdate, 'YYYY-MM-DD HH24:MI:SS' )
return v_rgmn_grp_path;
exception
-- when no_data_found
-- then
-- dbms_output.put_line
-- ( 'End of function hra_find_short_path to Check Circular Loop : '
-- || to_char ( sysdate, 'YYYY-MM-DD HH24:MI:SS' )
--return null;
when others
then
dbms_output.put_line
( 'Error in function DSSPPV.hra_find_short_path at: '
|| check_step
dbms_output.put_line ( sqlerrm );
dbms_output.put_line
( 'End of function hra_find_rgmn_grp_loops to Check Circular Loop : '
|| to_char ( sysdate, 'YYYY-MM-DD HH24:MI:SS' )
end hra_find_short_path;
/I purpose fully commented No Data Found Exception top check whether it was returning null when no record is found.
But it was going into no data found exception when there is no record.
But when execute sql separately it was showing zero records without raising the no data found error.
it was not even going through the if loop .... Please Correct me if i did something wrong
if ( v_rgmn_grp_path is not null )
then
dbms_output.put_line ( ' Circular Loop is formed as shown :'
|| v_rgmn_grp_path
else
dbms_output.put_line ( ' No Loop is formed.' );
end if;Hi,
Rede wrote:
Frank,
I am expecting that when no row is returned
select rgmn_path || '/' || gt.rgmn_grp_nam
into v_rgmn_grp_path
Null will be selected into v_rgmn_grp_path unless there is an exception
A SELECT INTO query must return exactly one row. If no rows satisfy the WHERE clause, then no rows are returned, and a NO_DATA_FOUND error is raised.
One way to get around this is to do an aggregate query. If you use an aggregate function (like MIN) but no GROUP BY clause, then exactly one row will always be returned, even if the table has no rows, or no rows satisfy the WHERE clause. (You've probably used this feature before, saying "SELECT COUNT(*) FROM table_x;" and getting one row, containing 0, in the result set.)
Try something like this
select MIN (rgmn_path || '/' || gt.rgmn_grp_nam)
into v_rgmn_grp_path
from ( select min_rgmn_node
,dssppv.t_market_cnfgr_rgmn_grp gt
where gt.rgmn_grp_gid = p_new_rgmn_grp_gid;Edited by: Frank Kulash on Jun 2, 2010 4:02 PM -
Hi everyone.
Can anyone tell me what is wrong in this code below?
Code:
function NO_DAYSFormula return Number is
begin
IF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT<:MATURITY_DATE
AND :ACCT_OPN_DT>:P_FR_DT
THEN RETURN (:P_TO_DT-:ACCT_OPN_DT+1);
ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT<:MATURITY_DATE
AND :ACCT_OPN_DT<:P_FR_DT
THEN RETURN (:P_FR_DT-:P_TO_DT+1);
ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT>:MATURITY_DATE
AND :ACCT_OPN_DT<:P_FR_DT
THEN RETURN (:P_FR_DT-:MATURITY_DATE+1);
END IF;
END;
It gets compiled successfully but when i run the report, i get 2 errors.
Error 1:
REP-1401: 'no_daysformula':Fatal PL/SQL error occurred.
ora-06503: PL/SQL : Function returned without value.
Error 2:
REP-0619: You cannot run without a layout.
Should i use only 1 return statement?
Can i use as many return statements as i want?
What is the exact mistake? Please let me know.
Thank You.Let me clear you the first thing...
If you get any fatal errors while running the report (e.g., function returned without value,no value etc.,) the report will show
REP-0619: You cannot run without a layout.
So you just correct the function 'no_daysformula' .
First of all you run the report without that formula column.
If it works fine then , Check the return value of your formula column (Your formula column properties --> Return value --> value (It will be DATE as i think so).
As function will always return a single value, Check your formula 'no_daysformula' returns the same.
declare a return variable say for example..
DECLARE
V_DATE DATE;
BEGIN
--YOUR CODE---
RETURN V_DATE := (RETURN VALUE)
END;
Last but not least ... use Else condition to return (NULL or any value ) in your code and check..
If any Problem persists let me know
Regards,
Soofi. -
Whee the function return the value store in java
in c if i write this program
int add()
return 1;
main()
add();
if i run this program it give s error that lvalue required
but in java it works fine though the function return some valuein c if i write this program
int add()
return 1;
main()
add();
if i run this program it give s error that lvalue
requiredYou mean, if you try to run it as a C program it gave an error?
Then take your question to a "C" discussion forum. This is Java.
>
but in java it works fine though the function return some value
In Java this does NOT work fine.
It definitely does not compile! So you cannot run it. -
HELP-Why won't this function return a value
I want to get this XML data OUT of the function, but it just
won't work. What I am doing wrong??? Tracing "xmlList" gives me the
output i want IN the function, but if I can't get it OUT. If i set
the function to "String", I still can't get the function to return
a value or anyway to get this data OUT of the function. Please
help.
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader;
xmlLoader.load(new URLRequest("data/imagesT.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):String
xml = XML(event.target.data);
xmlList = xml.children()[0].child(2);It won't though. Tracing xmlList outside (i.e. after it runs)
the function produces null with the function set to void. Inside
the function tracing producing the correct data. -
Can a function return two values???
Hi guys can a function return more than values?
Or even better return an Object.
ie
public class Tester{
public static Multi getM()
Multi m=new Multi();
m.x="testing";
m.y="new value";
public static void main(String [] args)
Multi mt=getM();
System.out.println(mt.x);
System.out.println(mt.y);
class Multi{
public String x;
public String y;
} -
Function returns several values
hi,
is it possible that function would return several values, for ex.:
select myfunct().val1, myfunct().val2 from dummy_tableTo add to the above,
How ever, a procedure using IN OUT parameters is not useful for SELECT statements,
One way is, you could use PL/SQL tables for that, here is how you do it-- create a SQL type
create type emp_num as table of number;
-- declare an array of emp_num type and use it to store multiple values
create or replace function getemp_num(ind Number) return Number Is
vEmpArray emp_num := emp_num();
Begin
FOR rec in (select empno from my_emp)
Loop
vEmpArray.extend;
vEmpArray(vEmpArray.count) := rec.empno;
End loop;
RETURN vEmpArray(ind);
End;
-- use the fn to return more than one value
select getemp_num(4), getemp_num(5) from dual;Thx,
SriDHAR -
Error with function returning "multiple" values
Hi
i am trying to write a function to return "multiple" values
however, it returned the following error during compilation
Compilation errors for FUNCTION sch1.myfn
Error: PLS-00382: expression is of wrong type
Line: 19
Text: RETURN V_res;
Error: PL/SQL: Statement ignored
Line: 19
Text: RETURN V_res;
ques :
1 - is there a need to always declare a table ? as it'll only return a single record with multiple columns
CREATE OR REPLACE TYPE result as table of result_t;
CREATE OR REPLACE TYPE result_t as object
(user varchar2(100), comments varchar2(4000));
CREATE OR REPLACE FUNCTION myfn (IN_ID IN VARCHAR2, IN_BEGIN IN DATE) RETURN result IS
type V_res_t is RECORD (user varchar2(100), comments varchar2(4000));
V_res V_res_t;
BEGIN
select a.user, a.comment
into V_res.user, V_res.comments
from view1 A,
(select distinct id,
begin_time,
max(time) over(order by time desc) max_time from view2 b
where id = IN_LOTID
and begin_time = IN_BEGIN) b
where a.id = b.id
and a.begin_time = b.begin_time
and a.time = max_time
and a.id = IN_ID
and a.begin_time = IN_BEGIN;
RETURN V_res; --> this is the line that the system keep complaining
END;
Note : pls ignore whether the return results is correct but i am expecting it to always return a single row
pls advise
tks & rgdsAnd if you really want to return a type as a table of, work with PIPELINED function :
SQL> CREATE OR REPLACE TYPE result_t as object
2 (user# varchar2(100), comments varchar2(4000));
3 /
Type created.
SQL> CREATE OR REPLACE TYPE result as table of result_t;
2 /
Type created.
SQL>
SQL> CREATE OR REPLACE FUNCTION myfn (IN_ID IN VARCHAR2, IN_BEGIN IN DATE) RETURN result
2 pipelined is
3 user# varchar2(100);
4 comments varchar2(4000);
5 BEGIN
6 pipe row (result_t(user#,comments));
7 return;
8 END;
9 /
Function created.
SQL>PS: there is non sense to use pipelined function in my example, it is just an example to return a type as table.
Nicolas. -
Analytic Function - Return 2 values
I am sure I need to use an analytic function to do this, I just cannot seem to get it right. I appreciate the help.
Table and insert statements:
create table TST_CK
DOC_ID NUMBER(6) not null,
ROW_SEQ_NBR NUMBER(6) not null,
IND_VALUE VARCHAR2(2) null
INSERT INTO TST_CK VALUES ('1','6',NULL);
INSERT INTO TST_CK VALUES ('1','5',NULL);
INSERT INTO TST_CK VALUES ('1','4','T');
INSERT INTO TST_CK VALUES ('1','3','R');
INSERT INTO TST_CK VALUES ('1','9',NULL);
INSERT INTO TST_CK VALUES ('1','10',NULL);
INSERT INTO TST_CK VALUES ('1','7','T');
INSERT INTO TST_CK VALUES ('1','8','R');
INSERT INTO TST_CK VALUES ('2','1',NULL);
INSERT INTO TST_CK VALUES ('2','2',NULL);
INSERT INTO TST_CK VALUES ('2','3','T');
INSERT INTO TST_CK VALUES ('2','4','R');
INSERT INTO TST_CK VALUES ('2','5',NULL);
INSERT INTO TST_CK VALUES ('2','6',NULL);
INSERT INTO TST_CK VALUES ('2','7','T');
INSERT INTO TST_CK VALUES ('2','8','R');
INSERT INTO TST_CK VALUES ('4','1',NULL);
INSERT INTO TST_CK VALUES ('4','2',NULL);
INSERT INTO TST_CK VALUES ('4','3','X1');
INSERT INTO TST_CK VALUES ('4','4',NULL);
INSERT INTO TST_CK VALUES ('4','5',NULL);
INSERT INTO TST_CK VALUES ('4','6',NULL);
INSERT INTO TST_CK VALUES ('4','7','T');
INSERT INTO TST_CK VALUES ('4','8','R');
INSERT INTO TST_CK VALUES ('4','9',NULL);
INSERT INTO TST_CK VALUES ('4','10',NULL);
INSERT INTO TST_CK VALUES ('4','11',NULL);
INSERT INTO TST_CK VALUES ('4','12',NULL);
INSERT INTO TST_CK VALUES ('4','13','T');
INSERT INTO TST_CK VALUES ('4','14','R');
INSERT INTO TST_CK VALUES ('4','15',NULL);
INSERT INTO TST_CK VALUES ('4','16',NULL);
COMMIT;Here is what I have tried that gets me close:
SELECT MAX (TST_CK.DOC_ID), MAX (TST_CK.ROW_SEQ_NBR), TST_CK.IND_VALUE
FROM ASAP.TST_CK TST_CK
WHERE (TST_CK.IND_VALUE IS NOT NULL)
GROUP BY TST_CK.IND_VALUE
ORDER BY 2 ASCHere is my desired result:
CV_1 CV_2
T ROr even better result would be:
concat(CV_1,CV_2)With result:
T,RThanks for looking
GHi,
I am sure I need to use an analytic function to do this, I just cannot seem to get it right. I appreciate the help.
Table and insert statements: ...Thanks for posting the CREATE TABLE and INSERT statements.
Don't forget to explain how you get the results you want from that sample data.
GMoney wrote:
create table TST_CK
DOC_ID NUMBER(6) not null,
ROW_SEQ_NBR NUMBER(6) not null,
IND_VALUE VARCHAR2(2) null
INSERT INTO TST_CK VALUES ('1','6',NULL);
If doc_id and row_seq_nbr are NUMBERs, why are you inserting VARCHAR2 values, such as '1' and '6' (in single-quotes)?
Here is my desired result:
CV_1 CV_2
T ROr even better result would be:
concat(CV_1,CV_2)With result:
T,R
The results from the query you posted are:
MAX(TST_CK.DOC_ID) MAX(TST_CK.ROW_SEQ_NBR) IN
4 3 X1
4 13 T
4 14 RWhat do the desired results represent?
Why do your desired results include 'R' and 'T', but not 'X1'? Why do you want
'T,R' and not
'X1,T,R' or
'X1,T' or
'T,X1' or something else?
Whatever your reasons are, there's a good chance you'll want to use String Aggregation . Your Oracle version is always important, but it's especially important in string aggregation problems, because some helpful new functions have beeen added in recent versions. Always say which version of Oracle (e.g., 11.2.0.3.0) you're using. -
NODIM function Returns wrong values?
Hi All,
We have a KF Quantity in PC and we are using NODIM(Quantity) to diaply it without units.But
NODIM(Quantity) displays wrong results.
For Example:Quantity = 3123214 PC and NODIM(Quantity) = 3123214.123
What could be the reason for it?can anyone explain me?
Thanks
Message was edited by: MurliThanks for your wishes on the other post.
My advance wishes to you for the same..
Dear Murali,
I am not sure the following 'note' can help us.. please have a look..
Note number: 604857: ( Also have a look at 590089,730382)
Incorrect number of decimal places with NODIM operator
Symptom
The system produces an incorrect proposal for the number of decimal places for a structure element.
Other terms
Query, NODIM, decimals, decimal places
Reason and Prerequisites
The key figure uses the NODIM operator
Solution
BW 3.0B
Import Support Package 12 for 3.0B (BW 3.0B Patch 12 or SAPKW30B12) into your BW system. This Support Package will be available when note 523249 with the short text "SAPBWNews BW 3.0B Support Package 12", which describes this Support Package in more detail, is released for customers.
To provide information in advance, note 523249 may already be available before the Support Package is released. In this case, the short text will still contain the words "preliminary version".
BW 3.1C
Import Support Package 06 for 3.1C (BW 3.1C Patch06 or SAPKW31C06) into your BW system. This Support Package will be available when note 539827 with the short text "SAPBWNews BW 3.1C Support Package 06", which describes this Support Package in more detail, is released for customers. For more information on BW Support Packages, see note 110934.
In urgent cases, you can implement the correction instructions in your system using transaction SNOTE.
Regards,
Hari
Message was edited by: Hari Kiran Y -
Function Does Not Return any value .
Hi ,
I am wrtting the below funtion without using any cursor to return any message if the value enters by parameters
does not match with the value reterived by the function select statement or it does not reterive any value that
for the parameters entered .
E.g:
CREATE OR REPLACE FUNCTION TEST_DNAME
(p_empno IN NUMBER,p_deptno IN NUMBER)
RETURN VARCHAR2
IS
v_dname varchar2(50);
v_empno varchar2(50);
V_err varchar2(100);
v_cnt NUMBER := 0;
BEGIN
SELECT d.dname,e.empno
INTO v_dname ,v_empno
FROM scott.emp e , scott.dept d
WHERE e.empno=p_empno
AND d.deptno=p_deptno;
--RETURN v_dname;
IF p_empno IS NOT NULL AND p_deptno IS NOT NULL
THEN IF v_dname is NULL THEN
v_err :='Not Valid';
RETURN v_err;END IF;
ELSIF p_empno IS NOT NULL AND p_deptno IS NOT NULL
THEN IF v_dname is NOT NULL THEN
RETURN v_dname; END IF;
ELSE
RETURN v_dname;
END IF;
END;
Sql Statement
SELECT TEST_DNAME(1234,30) FROM dual
AND IF I enter a valid combination of parameter then I get the below error :
e.g:
SQL> SELECT TEST_DNAME(7369,20) FROM dual
2 .
SQL> /
SELECT TEST_DNAME(7369,20) FROM dual
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "SCOTT.TEST_DNAME", line 24
Where I am missing .
Thanks,Format you code properly and look at it:
CREATE OR REPLACE
FUNCTION TEST_DNAME(
p_empno IN NUMBER,
p_deptno IN NUMBER
RETURN VARCHAR2
IS
v_dname varchar2(50);
v_empno varchar2(50);
V_err varchar2(100);
v_cnt NUMBER := 0;
BEGIN
SELECT d.dname,
e.empno
INTO v_dname,
v_empno
FROM scott.emp e,
scott.dept d
WHERE e.deptno=d.deptno
AND e.empno=p_empno
AND d.deptno=p_deptno;
--RETURN v_dname;
IF p_empno IS NOT NULL AND p_deptno IS NOT NULL
THEN
IF v_dname is NULL
THEN
v_err :='Not Valid';
RETURN v_err;
END IF;
ELSIF p_empno IS NOT NULL AND p_deptno IS NOT NULL
THEN
IF v_dname is NOT NULL
THEN
RETURN v_dname;
END IF;
ELSE
RETURN v_dname;
END IF;
END;
/Both p_empno and p_deptno in
SELECT TEST_DNAME(7369,20) FROM dualare not null. So SELECT will fetch some v_dname and v_empno. Since p_empno and p_deptno iare not null your code will go inside outer IF stmt and will execute its THEN branch. That branch consist of nothing but inner IF statement. And since v_dname is NOT NULL it will bypass that inner IF and exit the outer IF. And there is no RETURN stmt after that outer IF. As a result you get what you get - ORA-06503. Also, both if and elsif in your code check same set of conditions which makes no sense.
SY.
Maybe you are looking for
-
Erro interface NTB2B - atualização de Support Package GRC / PI - SP 19
Pessoal, Estou usando o cenário do NTB2B Z, daquela forma que criamos um Software Component novo e incluimos o SSL-NFE nas dependencias, e depois modificamos o interface mapping. O cenário já estava configurado e estava funcionando no SP18 do GRC (SA
-
CreateDesktop, ERROR CODE = 5, Access is denied. WTF!
2010-06-06 01:00:17,819 INFO [com.adobe.pdfg.GeneratePDFImpl] ALC-PDG-001-000- Job ID for the submitted createPDF job =File.pdf409521-3f3c2f-479b06-b279af-1e90c4-144464 2010-06-06 01:00:17,944 INFO [com.adobe.pdfg.BMCCaller] ALC-PDG-001-024-File.pd
-
Can anyone tell me if anyone from Apple reads these forums
*Can anyone tell me if anyone from Apple reads these forums and does anything about the issues experienced?* I still have a faulty proximity sensor, even after the latest download. I went to the Apple Store and they told me to stop using it with the
-
Get data every 2 columns at a time in excel
i would like to read the following excel file and plot every 2 columns at one time given an interval. for example at 7 am i ll plot corresponding I and V and at 8 am so on.. but even though i programmed my VI to read by increasing index 0,2,4 so on i
-
Implementation of SequenceImpl and third party Datasource
Hi ! When trying to use a third party datasource that supports sequences like i.e. maxdb (formaly sapdb) there is a problem with the implementation of the oracle.jbo.server.SequenceImpl class. This class generates a sql-statement like: select sequenc