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.
Similar Messages
-
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> -
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; -
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 -
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; -
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. -
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 -
Problem with function, need to return a very large number
I have a function that is used to derive a number by using a defined algorithm. We have tested it many times in our 'development' region and it works. We moved it to our 'UAT' region and now the function is giving an error. The data is the same in both oracle instances. So.... dba's are telling me it is the function. At this point, I don't know what to do.
Can I declare "RESULT" in a function so that it can return a number this big: 2.00023880306E24?
Oracle returns -6502 error in the deriveNewNum function.
Here is the error:
*** ERROR in deriveNewNum.fnc
SQLCODE: -6502
ORA-06502: PL/SQL: numeric or value error: number precision too large
BEGIN TF1ID; END;
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at DERIVENEWNUM", line 93
ORA-06512: at line 1Hi,
Did you look up that error in the error messages manual?
http://download.oracle.com/docs/cd/B28359_01/server.111/b28278/e4100.htm#sthref1889
Is there something there that you didn't understand?
<h3>ORA-06502: PL/SQL: numeric or value errorstring </h3>
Cause: An arithmetic, numeric, string, conversion, or constraint error occurred. For example, this error occurs if an attempt is made to assign the value NULL to a variable declared NOT NULL, or if an attempt is made to assign an integer larger than 99 to a variable declared NUMBER(2).
Action: Change the data, how it is manipulated, or how it is declared so that values do not violate constraints.
If you declare variables like this:
x NUMBER;
y NUMBER (20, 10);there woul be no problem assigning a value like 2E24 to x, but there would be if you tried it with y.
How are your varaibles declared.
Whenever you have a problem with your code, post your code.
Always say what version of Oracle you're using. -
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. -
Stacked 100% bar chart - Problem with datatips for zero value data points
I have a stacked 100% bar chart that shows datatips in Flex 4. However, I don't want it to show datatips for
data points with zero values. Flex 4 shows the datatip for a zero value data point on the left side of a bar if the data point is not the first in the series.
Here's the code that illustrates this problem. Of particular concern is the July bar. Because of the zero value data point problem, it's not possible to see the datatip for "aaa".
Any ideas on how we can hide/remove the datatips for zero value data points ? Thanks.
<?xml version="1.0"?>
<s:Application
xmlns:fx="
http://ns.adobe.com/mxml/2009"xmlns:mx="
library://ns.adobe.com/flex/mx"xmlns:s="
library://ns.adobe.com/flex/spark"creationComplete="initApp()"
height="
1050" width="600">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<fx:Script><![CDATA[
import mx.collections.ArrayCollection;[
Bindable]
private var yearlyData:ArrayCollection = new ArrayCollection([{month:
"Aug", a:1, b:10, c:1, d:10, e:0},{month:
"July", a:1, b:10, c:10, d:10, e:0},{month:
"June", a:10, b:10, c:10, d:10, e:0},{month:
"May", a:10, b:10, c:10, d:0, e:10},{month:
"April", a:10, b:10, c:0, d:10, e:10},{month:
"March", a:10, b:0, c:10, d:10, e:10},{month:
"February", a:0, b:10, c:10, d:10, e:10},{month:
"January", a:10, b:10, c:10, d:10, e:10}]);
private function initApp():void {}
]]>
</fx:Script>
<s:Panel title="Stacked Bar Chart - Problems with DataTips for Zero Value Items" id="panel1">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<mx:BarChart id="myChart" type="stacked"dataProvider="
{yearlyData}" showDataTips="true">
<mx:verticalAxis>
<mx:CategoryAxis categoryField="month"/>
</mx:verticalAxis>
<mx:series>
<mx:BarSeries
xField="a"displayName="
aaa"/>
<mx:BarSeries
xField="b"displayName="
bbb"/>
<mx:BarSeries
xField="c"displayName="
ccc"/>
<mx:BarSeries
xField="d"displayName="
ddd"/>
<mx:BarSeries
xField="e"displayName="
eee"/>
</mx:series>
</mx:BarChart>
<mx:Legend dataProvider="{myChart}"/>
</s:Panel>
<s:RichText width="700">
<s:br></s:br>
<s:p fontWeight="bold">The problem:</s:p>
<s:p>Datatips for zero value data points appear on left side of bar (if data point is not the first point in series).</s:p>
<s:br></s:br>
<s:p fontWeight="bold">For example:</s:p>
<s:p>1) For "June", eee = 0, mouse over the left side of the bar to see a datatip for "eee". Not good.</s:p>
<s:br></s:br>
<s:p>2) For "July", eee = 0 and aaa = 1, can't see the datatip for "aaa", instead "eee" shows. Real bad.</s:p>
<s:br></s:br>
<s:p>3) For "Feb", aaa = 0, datatip for "aaa" (first point) does not show. This is good.</s:p>
<s:br></s:br>
<s:p>4) For "Mar", bbb = 0, datatip for "bbb" shows on the left side of the bar. Not good.</s:p>
<s:br></s:br>
<s:p fontWeight="bold">Challenge:</s:p>
<s:p>How can we hide/remove datatips for zero value data points?</s:p>
<s:br></s:br>
</s:RichText></s:Application>FYI.
Still have the issue after upgrading to the latest Flex Builder 4.0.1 with SDK 4.1.0 build 16076.
Posted this as a bug in the Adobe Flex Bug and Issue Management system. JIRA
http://bugs.adobe.com/jira/browse/FLEXDMV-2478
Which is a clone of a similar issue with Flex 3 ...
http://bugs.adobe.com/jira/browse/FLEXDMV-1984 -
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. -
I'M HAVING PROBLEM WITH FUNCTION KEY, I'M HAVING PROBLEM WITH FUNCTION KEY
Hello everybody
Recently i'm having problem with function key of iphone4, now its working assistive touch key board , between these days i had restored and update then it work for next 12 hour after that it again stoped..
pls help me from this isssue,
thanking you.There are no function keys on the iPhone.
Please clearly state the issue that is occurring. -
Setting always changes by itself in my iPhone 5s, also every few calls I have to face a problem with a call without sound, battery becomes empty quickly
User troubleshooting steps as outlined in the manual are reset, restore, restore as new. Have you tried any of these?
-
Problem with the return value from a tablemodel after filtering
I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
**** This is the code to fill the jtable
DefaultTableModel modelo=(DefaultTableModel)this.jTable1.getModel();
while(rs.next()){
Object[] fila= new Object[2];
fila[0]=rs.getObject("id_categoria");
fila[1]=rs.getObject("nombre");
modelo.addRow(fila);
this.jTable1.getColumnModel().removeColumn(this.jTable1.getColumnModel().getColumn(0));
// I delete the first column because is a ID, I dont want that the user see it. the value is only for me**** this is the method to filter from the jtextfield
private void FiltrarJtable1() {
TableRowSorter sorter = new TableRowSorter(this.jTable1.getModel());
sorter.setRowFilter(RowFilter.regexFilter("^"+this.jTextField1.getText().toUpperCase(), 1));
this.jTable1.setRowSorter(sorter);
this.jTable1.convertRowIndexToModel(0);
}*** this is the method that return the ID (id_categoria) from the tablemodel
private void SeleccionarRegistro(){
if(this.jTable1.getSelectedRow()>-1){
String str_id =this.jTable1.getModel().getValueAt(this.jTable1.getSelectedRow(),0).toString();
int_idtoreturn=Integer.parseInt(str_id);
this.dispose();
}else{
JOptionPane.showMessageDialog(this,"there are no records selected","Warning!",1);
}Who I can solve this problem?m_ilio wrote:
I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
You're right in that you have to use convertRowIndexToModel(), but you are using it wrong. That method takes as input the index of a row in the view, i.e. the table, and returns the corresponding row in the underlying TableModel. No data is changed by the call, so this:
this.jTable1.convertRowIndexToModel(0);is meaningless by itself.
What you need to do is the following:
int selectedRow = this.jTable1.getSelectedRow(); // This is the selected row in the view
if (selectedRow >= 0) {
int modelRow = this.jTable1.convertRowIndexToModel(selectedRow); // This is the corresponding row in the model
String str_id =this.jTable1.getModel().getValueAt(modelRow, 0).toString();
}Hope this helps. -
Problem with QofQ and Null Values
Just converted from CF5 to CF7. Finally figured out what was
causing the error message :
"The value "" cannot be converted to a number" when running a
QofQ. It happens whenever there is a NULL (and I think a ZERO)
value in the QofQ. I'm using the QofQ in a seperate chart program.
The main query merges data from a store and a region table.
I'm doing a LEFT OUTER JOIN to combine the REGION with the STORE,
AND so that stores with NO SALES for a given day will show up as
ZERO. On the main report, when I don't use a QofQWhen grouping by
DAY or MONTH, I can test the value in the CFOUTPUT for NULL or ZERO
and display "0" or "N/A" on the report.
But when I try to chart it, using a QofQ to read in the
values from the main query, and format the numbers, I get this
error message. I've tried using the CAST function, using FLOAT,
DOUBLE, BIGINT, etc., but still get same error message.
The only way I could fix this is to add a WHERE statement to
the QofQ, that only includes sales values greater than ZERO. But
then, I have gaps in my chart because stores with NO SALES for a
given day or MONTH don't appear. Because they are removed from the
query. The whole point of LEFT JOINS is to include items with no
values (or NULL) values.
Does anyone know if it's possible to keep these values in a
QofQ? So that items (e.g., store locations in my case) with NULL or
ZERO values for some or all days or months can be charted? Even
with a ZERO value? I've read everything I can get my hands on
regarding QofQ, the CAST function, etc., but nothing seems to work.
Thanks for any help. (FYI, didn't have this problem with CF5. It's
QofQ could handle NULL or ZERO values without providing an error).
GaryWell, I tried the IsNull function on the 3 SUM() values I was
calculating in my SELECT statement (on a LEFT OUTER JOIN QUERY),
and I STILL got another "cannot convert "" to a number" but this
time the error message was more direct, and pointed me to a DATE
field in my query, where I was SORTING AND GROUPING either by DAY
or MONTH (depending on what user selected on form).
In my QofQ, I'm not just reformating the integer SUM()
values, but also the date values. So, I applied the IsNull()
function to the DATE values in my main query. I still kept getting
errors. But after experimenting ((SQL Server BOL docs doesn't give
ISNULL() examples for DATE FIELDS, only NUMBER fields), I tried
putting the dates in SINGLE QUOTES in my IsNull() function, the
QUERY RAN. Then I wasn't sure WHAT date to enter, e.g., 1/1/1889 or
1/1/2001, etc.
Then, I discovered, after experimenting, that you cannot just
blindly enter ANY date when using IsNull in a date field,
especially if you are using CFGRAPH to chart the results by day.
You have to select a date within the date range the user selected,
so this means using the FORM.DATE (or URL.DATE) value from the
form. Here's the working example from my SELECT main query:
SELECT SUM(ISNULL(d.ttldb,0)) AS SumOfDB,
SUM(ISNULL(d.ttldbv,0)) AS SumOfDBV,
SUM(ISNULL(d.ttldbi,0)) AS SumOfDBI,
<CFIF '#url.reptype#' IS "DAILY">
ISNULL(d.depday, '#url.date1#') AS depday
<CFELSE>
month(ISNULL(d.depday, '#url.date2#')) AS TranMonth,
year(ISNULL(d.depday, '#url.date2#')) AS TranYear
</CFIF>
Then I discovered that whatever date was used in the URL.DATE
field (in my case it would be one of the two date field from the
form, and depended on whether you coded DATE1 or DATE2, the chart
would always show ZERO values for that date. So I tried putting the
IsNull() date values in the GROUP BY and ORDER BY statements, e.g.,
<CFIF '#url.reptype#' IS "DAILY">
GROUP BY ISNULL(d.depday, '#url.date1#')
ORDER BY ISNULL(d.depday, '#url.date1#') DESC
<CFELSE>
GROUP BY year(ISNULL(d.depday, '#url.date2#')),
month(ISNULL(d.depday, '#url.date2#'))
ORDER BY year(ISNULL(d.depday, '#url.date2#')),
month(ISNULL(d.depday, '#url.date2#'))
</CFIF>
And this worked. The report ran just fine, and the chart
charted every value correctly.
I guess you have to learn all the little "quirks" about CF7
and how it's QofQ and chart programs work. But so far, so good.
Thank you all for your help. Now I've got to update other old
CF5 programs that are returning errors when there are null values
from my LEFT OUTER JOIN queries. Will take some time, but at least
I know how to do it. Thanks to your help.
I really appreciate your time and efforts to help with this
issue.
Gary
Maybe you are looking for
-
Can't Burn CDs (emachines T3830) - used to be able to
All of a sudden, I can't burn CDs. I was able to up until recently. I installed the Acura TTS software to allow me use my IPOD in a new car and was wondering if anyone knew if this interfered with the burn function. Orif the CD diagnostics indicate s
-
How to Swithch on Modification Assitance in Program
Hi friends, please let me know how to switch on modification assitance in my program. pls help me out regarding that.. regards devi
-
GUI 620 Patch 66, 710 Patch 5 for ECC 6.0
We are in the process of installing support packages 4 - 12 for ECC 6.0. Obviously, we're going to do this in stages because of the amount of notes each package contains. My question to the forum is regarding issues you may have encountered by runn
-
Hello, Given this code... quote: for (var i:uint = 0; i < 10; i++) Alert.show(i.toString()); The alert box counts down from 9 -- shouldn't it start counting up from 0?? Why does it appear that loops are going in reverse? Thanks, Tom
-
Recommendations for wireless adapter to use with Tivo?
I'm shopping for my first Tivo box, and was wondering if any of the Tivo-recommended wireless USB adapters work better with Airport/Mac than the others? Thanks! Erin