Error in pipe row function.
Hi,
I wrote the below function,if i select the functions,it returns below error
create or replace
FUNCTION FUN_CHR_SEP(P_FLAG IN VARCHAR2)
RETURN COLS_VAL PIPELINED
AS
cursor C_CHR_SEP is
select text from
(SELECT SUBSTR(
txt,
INSTR(',' || txt,',',1,LEVEL),
INSTR(txt || ',',',',1,LEVEL) - INSTR(',' || txt,',',1,LEVEL)
) TEXT
from (select P_FLAG TXT from DUAL) T
connect by level <= length(TXT)-length(replace(TXT,',')) + 1);
BEGIN
for REC in C_CHR_SEP LOOP
PIPE ROW (CHR_COLS_VAL(REC.text));
END LOOP;
END;
select * from table(cast(FUN_CHR_SEP('A,C,V,B') as COLS_VAL));
Error:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "SHIPLUS.FUN_CHR_SEP", line 18
Note : CHR_COLS_VAL and COLS_VAL are Type.
Regards,
Fame
This is the forum for SQL Developer (Not for general SQL/PLSQL questions), you should ask your question in the SQL and PL/SQL forum.
Having said that, your function has no return statement.
Similar Messages
-
Hi can someone tell me whats wrong in the below function code? Its compilation error
table and Type structure are below for creating the same function.
SQL> desc tt
Name Null? Type
NO NUMBER
NAME VARCHAR2(20)
SQL> select * from tt;
NO NAME
30 WSS
40 SYS
10 WSS
20 SYS
create or replace type tt_typ as object
(no number,
name varchar2(20));
create or replace type rec_tt_type as table of tt_typ;
Type created.
create or replace function fn1 return rec_tt_type pipelined as
table_tt tt%rowtype;
var_tt tt%rowtype;
cursor c1 is select * from tt;
begin
open c1;
loop
fetch c1 into table_tt;
execute immediate ' select no, name from tt where no = :1' into var_tt using table_tt.no;
pipe row(var_tt);
end loop;
return;
end;
sho err;
Errors for FUNCTION FN1:
LINE/COL ERROR
23/3 PL/SQL: Statement ignored
23/12 PLS-00382: expression is of wrong type
SQL>SQL> create table tt
as
select 30 no, 'WSS' name from dual
union all
select 40 no, 'SYS' name from dual
union all
select 10 no, 'WSS' name from dual
union all
select 20 no, 'SYS' name from dual
Table created.
SQL> create or replace type tt_typ as object
(no number, name varchar2 (20));
Type created.
SQL> create or replace type rec_tt_type as table of tt_typ;
Type created.
SQL> create or replace function fn1
return rec_tt_type
pipelined
as
cursor c1
is
select * from tt;
table_tt c1%rowtype;
var_tt c1%rowtype;
begin
open c1;
loop
fetch c1 into table_tt;
exit when c1%notfound;
execute immediate ' select no, name from tt where no = :1 '
into var_tt
using table_tt.no;
pipe row (tt_typ (var_tt.no, var_tt.name));
end loop;
return;
end fn1;
Function created.
SQL> select * from table (fn1)
NO NAME
30 WSS
40 SYS
10 WSS
20 SYS
4 rows selected. -
Error while executing a function
I had created a function F_GET_PRH_NO_QTY. While using this function in a query system is giving me error as given below :
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "ORION_REPORTS.F_GET_PRH_NO_QTY", line 36
CREATE OR REPLACE FUNCTION F_GET_PRH_NO_QTY(P_PWH_NO NUMBER)
RETURN VARCHAR2
AS
L_RET_VAL VARCHAR2(4000);
CURSOR C1 IS
SELECT REP_NO, REP_QTY
FROM
SELECT PRH_NO REP_NO, NVL(PRSO_REP_QTY_BU/IU_CONV_FACTOR/IU_MAX_LOOSE_1,0) REP_QTY
FROM OT_PR_HEAD, OT_PWO_HEAD, OT_PR_WO_DETAIL, OT_PR_STAGE_OUTPUT, OM_ITEM, OM_ITEM_UOM
WHERE ITEM_CODE = IU_ITEM_CODE AND ITEM_UOM_CODE = IU_UOM_CODE
AND PWH_SYS_ID = PRH_REF_SYS_ID (+)
AND PRH_SYS_ID = PRWD_PRH_SYS_ID -- FROM OT_PR_WO_DETAIL TABLE
AND PRWD_SYS_ID = PRSO_PRWD_SYS_ID -- FROM OT_PR_STAGE_OUTPUT TABLE
AND PWH_NO = P_PWH_NO
M_REP_NO VARCHAR2(40);
M_REP_QTY VARCHAR2(40);
M_TEMP1 NUMBER := 0;
M_RNO_RQTY VARCHAR2(2000);
BEGIN
IF C1%ISOPEN THEN
CLOSE C1;
END IF;
OPEN C1;
LOOP
FETCH C1 INTO M_REP_NO, M_REP_QTY;
EXIT WHEN C1%NOTFOUND;
M_TEMP1 := M_TEMP1 + 1;
IF M_TEMP1 = 1 THEN
M_RNO_RQTY := M_REP_NO||'-'||M_REP_QTY;
ELSE
M_RNO_RQTY := M_RNO_RQTY||', '||M_REP_NO||' - '||M_REP_QTY;
END IF;
END LOOP;
--RETURN NVL(M_RNO_RQTY,'');
RETURN L_RET_VAL;
END;
Yogeshyou need to use pipelined function to break into small chunks...
CREATE OR REPLACE
FUNCTION F_GET_PRH_NO_QTY
P_PWH_NO NUMBER)
RETURN VARCHAR2 PIPELINED
IS
L_RET_VAL VARCHAR2(4000);
v_counter NUMBER := 1;
v_temp VARCHAR2(4000) := NULL;
CURSOR C1
IS
SELECT REP_NO,
REP_QTY
FROM
(SELECT PRH_NO REP_NO,
NVL(PRSO_REP_QTY_BU/IU_CONV_FACTOR/IU_MAX_LOOSE_1,0) REP_QTY
FROM OT_PR_HEAD ,
OT_PWO_HEAD ,
OT_PR_WO_DETAIL ,
OT_PR_STAGE_OUTPUT,
OM_ITEM ,
OM_ITEM_UOM
WHERE ITEM_CODE = IU_ITEM_CODE
AND ITEM_UOM_CODE = IU_UOM_CODE
AND PWH_SYS_ID = PRH_REF_SYS_ID
AND PRH_SYS_ID = PRWD_PRH_SYS_ID -- FROM OT_PR_WO_DETAIL TABLE
AND PRWD_SYS_ID = PRSO_PRWD_SYS_ID -- FROM OT_PR_STAGE_OUTPUT TABLE
AND PWH_NO = P_PWH_NO
M_REP_NO VARCHAR2(40);
M_REP_QTY VARCHAR2(40);
M_TEMP1 NUMBER := 0;
M_RNO_RQTY VARCHAR2(2000);
BEGIN
IF C1%ISOPEN THEN
CLOSE C1;
END IF;
OPEN C1;
LOOP
FETCH C1 INTO M_REP_NO, M_REP_QTY;
EXIT
WHEN C1%NOTFOUND;
M_TEMP1 := M_TEMP1 + 1;
IF M_TEMP1 = 1 THEN
M_RNO_RQTY := M_REP_NO||'-'||M_REP_QTY;
ELSE
M_RNO_RQTY := M_RNO_RQTY||', '||M_REP_NO||' - '||M_REP_QTY;
END IF;
END LOOP;
LOOP
v_temp := SUBSTR(v_xml, v_counter, 4000);
EXIT
WHEN v_temp IS NULL;
pipe ROW(v_temp);
v_counter := v_counter + 4000;
END LOOP;
RETURN ;
END;
/untested....
for executing above
select * from table(F_GET_PRH_NO_QTY(<your variable inside quotes>))Ravi Kumar -
Error while compling a Function:
Hi,
I am unable to complie a function as shown below:
CREATE OR REPLACE FUNCTION GET_SUBS_TYPE_KEY(
SUBNO VARCHAR2 DEFAULT NULL
RETURN SUBS_TYPE_KEY_1 PIPELINED AS
V_SUBNO VARCHAR2(40);
V_PAID VARCHAR2(10);
V_SUBS_TYP_KEY VARCHAR2(10);
V_VAL1 VARCHAR2(255);
CURSOR C1_REC IS SELECT SUBNO,PREPOST_PAID,SUBS_TYPE_KEY
FROM CTVA_ETL.RA_CRM_USER_INFO,DIM_SUBSCRIBER_TYPE
WHERE SUBSTR(DIM_SUBSCRIBER_TYPE.SUBS_TYPE_DESC,1,4)=RA_CRM_USER_INFO.PREPOST_PAID
--WHERE MSISDN='8615025400109'
--WHERE MSISDN IN ('8615025400068','8615025400083','8615025400101','8615025400132','8615025400109')
GROUP BY SUBNO,PREPOST_PAID,SUBS_TYPE_KEY;
BEGIN
OPEN C1_REC;
LOOP
FETCH C1_REC INTO V_SUBNO SUBNO_TYP_1,V_PAID,V_SUBS_TYP_KEY SUBS_TYP_KEY;
--DBMS_OUTPUT.PUT_LINE('THE MSISDN VALUE'||V_MSISDN);
EXIT WHEN C1_REC%NOTFOUND;
IF V_PAID='PREP' THEN
V_SUBS_TYP_KEY ='2';
ELSIF V_PAID='POST' THEN
V_SUBS_TYP_KEY ='2';
ELSE
V_SUBS_TYP_KEY ='-99';
LOOP
PIPE ROW ( SUBS_TYPE_KEY(C1_REC.SUBNO_TYP_1 ,C1_REC.SUBS_TYP_KEY ));
END LOOP;
END LOOP;
RETURN;
CLOSE C1_REC;
END;
its giving error in the SUBNO_TYP_1 TypeUn-formatted code is nothing but garbage. So always format your code.
CREATE OR REPLACE FUNCTION get_subs_type_key(
subno VARCHAR2 DEFAULT NULL) RETURN subs_type_key_1 pipelined
AS
v_subno VARCHAR2(40);
v_paid VARCHAR2(10);
v_subs_typ_key VARCHAR2(10);
v_val1 VARCHAR2(255);
CURSOR c1_rec
IS
SELECT subno,
prepost_paid,
subs_type_key
FROM ctva_etl.ra_crm_user_info,
dim_subscriber_type
WHERE SUBSTR(dim_subscriber_type.subs_type_desc, 1, 4) = ra_crm_user_info.prepost_paid
GROUP BY subno,
prepost_paid,
subs_type_key;
BEGIN
OPEN c1_rec;
LOOP
FETCH c1_rec INTO v_subno subno_typ_1, v_paid, v_subs_typ_key; <<-- Here i removed subs_typ_key Only god knows why you had it there.
--DBMS_OUTPUT.PUT_LINE('THE MSISDN VALUE'||V_MSISDN);
EXIT WHEN c1_rec % NOTFOUND;
IF v_paid = 'PREP'
THEN
v_subs_typ_key = '2';
ELSIF v_paid = 'POST'
THEN
v_subs_typ_key = '2';
ELSE
v_subs_typ_key = '-99';
LOOP
pipe ROW(subs_type_key(c1_rec.subno_typ_1, c1_rec.subs_typ_key));
END LOOP;
ENDIF; <<-- Here i closed your IF statement
END LOOP;
RETURN;
CLOSE c1_rec;
END; -
Error in executing the function
hi I tried the following function , FUNCTION is creating fine but getting the error while executing...
SQL> create or replace FUNCTION getPmnOrgRow(empId emp.EMPNO%TYPE)
2 RETURN EMP%ROWTYPE
3 IS
4 result EMP%ROWTYPE;
5 BEGIN
6 SELECT *
7 INTO result
8 FROM EMP
9 WHERE EMPNO = empId;
10 RETURN result;
11 EXCEPTION
12 WHEN NO_DATA_FOUND THEN
13 raise_application_error(-20100,'error');
14 RETURN NULL;
15 END;
16 /
Function created.
SQL> select getPmnOrgRow(7566) from dual;
select getPmnOrgRow(7566) from dual
ERROR at line 1:
ORA-00902: invalid datatypePipelined function will work for you ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.18
satyaki>
satyaki>
satyaki>create or replace type pipe_sl as object
2 (
3 empno number(5),
4 ename varchar2(30),
5 sal number(7,2),
6 hr_dt date
7 );
8 /
Type created.
Elapsed: 00:00:05.08
satyaki>
satyaki>create or replace type pipe_sl_rec as table of pipe_sl;
2 /
Type created.
Elapsed: 00:00:00.23
satyaki>
satyaki>create or replace function pi_pe_sel(empId emp.EMPNO%TYPE)
2 return pipe_sl_rec
3 pipelined
4 is
5 cursor c1
6 is
7 select pipe_sl(
8 empno,
9 ename,
10 sal,
11 hiredate
12 ) data
13 from emp
14 WHERE EMPNO = empId;
15
16 r1 c1%rowtype;
17 begin
18 for r1 in c1
19 loop
20 pipe row(r1.data);
21 end loop;
22
23 return;
24 end;
25 /
Function created.
Elapsed: 00:00:00.63
satyaki>
satyaki>
satyaki>select * from table(cast(pi_pe_sel(7369) as pipe_sl_rec));
no rows selected
Elapsed: 00:00:00.77
satyaki>
satyaki>
satyaki>select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10
7777 SOURAV SLS 14-SEP-08 45000 3400 10
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 4450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 7000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
13 rows selected.
Elapsed: 00:00:00.31
satyaki>select * from table(cast(pi_pe_sel(9999) as pipe_sl_rec));
EMPNO ENAME SAL HR_DT
9999 SATYAKI 55000 02-NOV-08
Elapsed: 00:00:00.15
satyaki>Regards.
Satyaki De. -
Does use of pipelined/pipe row have a limitation on amount of data returned
We are using Oracle 9i.
We have an existing function that pipes data. Select * from table(cast(schema.my_pkg.get_data() as schema.t_my_data_tab))
Function runs, but only returns around 10,000 records. There are actually about 50,000 records to be returned. I do not believe it is just erroring out one a single and stopping because I sorted my cursor multiple ways to show that in one sort certain records do not show, but when sorted another way they do. It is still possible something is stopping it - I will continue looking. But I would like to know if anyone is aware of any size limitations in the amount of data to be piped? I've looked at the types created & the function and do not see anything that was set for a size. Any ideas?
I apologize I do not know all the correct terms to use. I am taking this over from someone else - hopefully an example of their code will help. Thank you very much.
FUNCTION get_data(p_id NUMBER DEFAULT NULL)
RETURN t_my_data_tab PIPELINED
AS
v_temp VARCHAR2(10);
BEGIN
PIPE ROW
(t_links_contracts_rec
(...data values....)
RETURN;
END;I'm not sure really, if there was a limitation I believe it would be documented and even would raise an exception. I've only used pipelined table function for smallish sets of data. I can't simulate much as I only have access to 10g and 11g here, so I ran a query with 50,000, but I'm only posting its count for obvious reasons.
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
Connected as fsitja
SQL> create or replace type t_tab is table of number;
2 /
Type created
SQL>
SQL> create or replace function test_pipe return t_tab pipelined as
2 begin
3 for i in 1 .. 50000
4 loop
5 pipe row (i);
6 end loop;
7 end;
8 /
Function created
SQL> select count(*) from table(test_pipe);
COUNT(*)
50000
SQL> Some docs referencing the subject from 9i:
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/08_subs.htm
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96595/dci12tbl.htm -
SP which returns error cannot access rows from a non-nested table item.
Dear Experts
I have an SP which gives error " cannot access rows from a non-nested table item ". But here the strange thing is, it works fine with one query. But I write union query with another table, only then it gives error.
CREATE OR REPLACE PROCEDURE SP_MONTHLYSALESUMMARY (
P_TRANSACTIONMONTH VARCHAR2,
P_LEDGERID VARCHAR2,
O_RESULTSET OUT TYPES.CURSORTYPE)
AS
BEGIN
OPEN O_RESULTSET FOR
-- POINT OF SALE
SELECT
L.DESCRIPTION LEDGERNAME,
LS.DESCRIPTION LEDGERSUBGROUPNAME,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO
AS ID,
C.NAME || E.NAME || AF.NAME || M.NAME AS NAME,
SUM(CASE
WHEN PB.EMPLOYEE_ID IS NOT NULL
AND T.ISCREDITTRANSACTIONMODE = 2
THEN
PB.TAXAMOUNT
ELSE
0
END)
EMPLOYEEDEBITCARDTAXAMOUNT,
L.PRINTNO
FROM POINTOFSALEBILL PB
INNER JOIN POINTOFSALEBILLDETAIL PD
ON PB.POINTOFSALEBILL_ID = PD.POINTOFSALEBILL_ID
INNER JOIN TRANSACTIONTYPE TY
ON TY.TRANSACTIONTYPE_ID = PB.TRANSACTIONTYPE_ID
INNER JOIN TRANSACTIONMODE T
ON T.TRANSACTIONMODE_ID = PB.TRANSACTIONMODE_ID
INNER JOIN LEDGER L
ON L.LEDGER_ID = PD.LEDGER_ID
INNER JOIN LEDGERSUBGROUP LS
ON LS.LEDGERSUBGROUP_ID = L.LEDGERSUBGROUP_ID
LEFT JOIN CORPORATE C
ON C.CORPORATE_ID = PB.CORPORATE_ID
LEFT JOIN EMPLOYEE E
ON E.EMPLOYEE_ID = PB.EMPLOYEE_ID
LEFT JOIN AFFILIATEMEMBER AF
ON AF.AFFILIATEMEMBER_ID = PB.AFFILIATEMEMBER_ID
LEFT JOIN MEMBER M
ON M.MEMBER_ID = PB.MEMBER_ID
WHERE TY.ISDEBIT = 1 AND PB.FLAG = 0 AND T.ISROOMNO = 2
AND (P_TRANSACTIONMONTH IS NULL
OR P_TRANSACTIONMONTH =
TO_CHAR (PB.BILLDATE, 'fmMONTH-YYYY'))
AND (P_LEDGERID IS NULL
OR L.LEDGER_ID IN
( (SELECT COLUMN_VALUE
FROM TABLE(GET_ROWS_FROM_LIST1 (
P_LEDGERID,
GROUP BY L.DESCRIPTION,
LS.DESCRIPTION,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO,
C.NAME || E.NAME || AF.NAME || M.NAME,
L.PRINTNO;
END SP_MONTHLYSALESUMMARY;
GET_ROWS_FROM_LIST1 is a function, which i am using to pass " IN " to oracle. There is no problem with this, since it works fine with one query
REATE OR REPLACE FUNCTION BCLUB1868.GET_ROWS_FROM_LIST1
(L IN LONG DEFAULT NULL, SEP IN VARCHAR2 DEFAULT ',')
RETURN MYVARCHARTABLE1 PIPELINED
AS
L_POS INT := 1;
L_NEXT INT;
L_PART VARCHAR(500);
BEGIN
SELECT INSTR( L, SEP, L_POS) INTO L_NEXT FROM DUAL;
WHILE (L_NEXT>0)
LOOP
SELECT SUBSTR(L, L_POS, L_NEXT - L_POS) INTO L_PART FROM DUAL;
PIPE ROW(L_PART);
SELECT L_NEXT + 1, INSTR( L, SEP, L_POS)
INTO L_POS, L_NEXT FROM DUAL;
END LOOP;
SELECT SUBSTR(L, L_POS) INTO L_PART FROM DUAL;
PIPE ROW(L_PART);
RETURN;
END;
Request help from you all experts in the forumHere it is
CREATE OR REPLACE PROCEDURE SP_GRCS (
P_TRANSACTIONMONTH VARCHAR2,
P_LEDGERID VARCHAR2,
O_RESULTSET OUT TYPES.CURSORTYPE)
AS
BEGIN
OPEN O_RESULTSET FOR
-- Point of sale
SELECT *
FROM ( SELECT L.DESCRIPTION LEDGERNAME,
LS.DESCRIPTION LEDGERSUBGROUPNAME,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO
AS ID,
C.NAME || E.NAME || AF.NAME || M.NAME AS NAME,
SUM(CASE
WHEN PB.EMPLOYEE_ID IS NULL
AND T.ISCREDITTRANSACTIONMODE = 1
THEN
PB.BILLAMOUNT
ELSE
0
END)
MEMBERDEBITAMOUNT,
L.PRINTNO
FROM POINTOFSALEBILL PB
INNER JOIN POINTOFSALEBILLDETAIL PD
ON PB.POINTOFSALEBILL_ID = PD.POINTOFSALEBILL_ID
INNER JOIN TRANSACTIONTYPE TY
ON TY.TRANSACTIONTYPE_ID = PB.TRANSACTIONTYPE_ID
INNER JOIN TRANSACTIONMODE T
ON T.TRANSACTIONMODE_ID = PB.TRANSACTIONMODE_ID
INNER JOIN LEDGER L
ON L.LEDGER_ID = PD.LEDGER_ID
INNER JOIN LEDGERSUBGROUP LS
ON LS.LEDGERSUBGROUP_ID = L.LEDGERSUBGROUP_ID
LEFT JOIN CORPORATE C
ON C.CORPORATE_ID = PB.CORPORATE_ID
LEFT JOIN EMPLOYEE E
ON E.EMPLOYEE_ID = PB.EMPLOYEE_ID
LEFT JOIN AFFILIATEMEMBER AF
ON AF.AFFILIATEMEMBER_ID = PB.AFFILIATEMEMBER_ID
LEFT JOIN MEMBER M
ON M.MEMBER_ID = PB.MEMBER_ID
WHERE TY.ISDEBIT = 1 AND PB.FLAG = 0 AND T.ISROOMNO = 2
AND (P_TRANSACTIONMONTH IS NULL
OR P_TRANSACTIONMONTH =
TO_CHAR (PB.BILLDATE, 'fmMONTH-YYYY'))
AND (P_LEDGERID IS NULL
OR L.LEDGER_ID IN
( (SELECT COLUMN_VALUE
FROM TABLE(GET_ROWS_FROM_LIST1 (
P_LEDGERID,
GROUP BY L.DESCRIPTION,
LS.DESCRIPTION,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO,
C.NAME || E.NAME || AF.NAME || M.NAME,
L.PRINTNO
UNION ALL
-- Guest Registration
SELECT L.DESCRIPTION LEDGERNAME,
LS.DESCRIPTION LEDGERSUBGROUPNAME,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO
AS ID,
C.NAME || E.NAME || AF.NAME || M.NAME AS NAME,
SUM(CASE
WHEN PB.EMPLOYEE_ID IS NULL
AND T.ISCREDITTRANSACTIONMODE = 1
THEN
PB.BILLAMOUNT
ELSE
0
END)
MEMBERDEBITAMOUNT,
L.PRINTNO
FROM GUESTREGISTRATION PB
INNER JOIN GUESTREGISTRATIONDETAIL PD
ON PB.GUESTREGISTRATION_ID = PD.GUESTREGISTRATION_ID
INNER JOIN TRANSACTIONTYPE TY
ON TY.TRANSACTIONTYPE_ID = PB.TRANSACTIONTYPE_ID
INNER JOIN TRANSACTIONMODE T
ON T.TRANSACTIONMODE_ID = PB.TRANSACTIONMODE_ID
INNER JOIN LEDGER L
ON L.LEDGER_ID = PD.LEDGER_ID
INNER JOIN LEDGERSUBGROUP LS
ON LS.LEDGERSUBGROUP_ID = L.LEDGERSUBGROUP_ID
LEFT JOIN CORPORATE C
ON C.CORPORATE_ID = PB.CORPORATE_ID
LEFT JOIN EMPLOYEE E
ON E.EMPLOYEE_ID = PB.EMPLOYEE_ID
LEFT JOIN AFFILIATEMEMBER AF
ON AF.AFFILIATEMEMBER_ID = PB.AFFILIATEMEMBER_ID
LEFT JOIN MEMBER M
ON M.MEMBER_ID = PB.MEMBER_ID
WHERE TY.ISDEBIT = 1 AND PB.FLAG = 0 AND T.ISROOMNO = 2
AND (P_TRANSACTIONMONTH IS NULL
OR P_TRANSACTIONMONTH =
TO_CHAR (PB.BILLDATE, 'fmMONTH-YYYY'))
AND (P_LEDGERID IS NULL
OR L.LEDGER_ID IN
( (SELECT COLUMN_VALUE
FROM TABLE(GET_ROWS_FROM_LIST1 (
P_LEDGERID,
GROUP BY L.DESCRIPTION,
LS.DESCRIPTION,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO,
C.NAME || E.NAME || AF.NAME || M.NAME,
L.PRINTNO)
ORDER BY PRINTNO;
END SP_GRCS;
I have even tried adding L.Ledger_ID in select statement. -
hi i am getting tihs error msg
Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum
i'll try to show a form table in which i can edit and add data
when i use the wizzard it is all fine with editing but i cant creat a new item because i have to insert my primary key and that shoud be done automatically.
ok again
my PK is at first col1 and second col2
i got a dropdown list in which i choose an item from col1 to just show items in my form with that value, here are more than one results possible
no i want to edit col2 up to col4
or add a line with the same col1 but different col2 and some col3-col4 values
but if i add a line i want to insert col2 to up to col4 (and the PK from col1 shoud be automatically insert from my dropwdown list i choosed before)
i want in col2 an drop down list
so all this works fine i got all the changes i want but when i try do save or update my changes i got the error frome above
i think the problem is at the primary key thing cause i want to choose a part manually but i have to
to get the new line actually u use the add row link but i use instead after my select statement an
Union select :P62_PNR_VOll, null, null, null from dual
to get my first pk automatically from my dropdown element (in my case :P62_PNR_VOLL)
how can i solve that error?
thx for ur help
regadrs
FalkHi Falk,
It is usually best to have a sequence number for the primary key on a table. If you need to restrict other fields to be unique, then you can create a constraint to do this.
To create a sequence number and apply this to a new record, you need to do two things:
Let us say that you have a table called TABLEX and this has a numeric primary key field of ID. Do the following in the SQL Commands window
1 - Create a sequence SQL object:
CREATE SEQUENCE "TABLEX_ID_SEQ" MINVALUE 1 MAXVALUE 99999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE2 - Create a trigger:
CREATE OR REPLACE TRIGGER "TABLEX_BI"
BEFORE
INSERT ON "TABLEX"
FOR EACH ROW
BEGIN
IF :NEW.ID IS NULL THEN
SELECT TABLEX_ID_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
END IF;
END;This needs to be enabled, so run:
ALTER TRIGGER "TABLEX_BI" ENABLEWhen this is done, you then have "An existing trigger" that you can use for your tabular form. When a new record is created, the trigger is run and this checks for a value in the ID field. If this is NULL, then the next value in the sequence is assigned to it.
Primary Keys can be based on other values. You can use any value from the current record - for example, if you need to get the value from the XXX field, you just reference :NEW.XXX You can use this to pass into a function that returns your new primary key value. But I would recommend keeping to one field for your primary key as this makes things a lot simpler later on.
Andy -
Error in nested group function used with column name.
Hi Team,
If i used nested group function with column name its not working. Could you please any one suggest me.
How to use it.
Regards,
Venkat.
Please find Spool ........
SQL> select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name,CNT;
select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
ERROR at line 1:
ORA-00937: not a single-group group function
SQL> select max(max(CNT)) from(select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name;
MAX(MAX(CNT))
605Venkat wrote:
Hi Sayan
Its giving output like below, but not given maximum CNT.
SQL> select user_name,max(CNT)from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name;
USER_NAME MAX(CNT)
BANES_LERG 6
VENE_USER 8
USER3 339
DBUS 106
VEL_USER 37
SYS 597
6 rows selected.Check it - Re: Error in nested group function used with column name.
and previous post -
I have a function that returns pipelined row, and need to pass parameter to oracle report to call this function, how can i do it in the report query?
following is a sample:
function get_info (v1 number, v2 varchar2)
return my_row pipelined
pipe row ( ......).
now in the report query
select * from table(get_info(????)),
how to pass these as parameter?It was a bug on the PC I worked on.
Problem solved -
Opposite of PIPE ROW(out_rec) in oracle
when a function is to return large amount of data, can be done by PIPE ROW(out_rec) in oracle to return when the data is ready.
similaly in order to accept large amount of data from the application do we have any processYou should look for sqlloader and use a differentformat. It will be X times faster!
Can you mention about the different format?What he means is that you do not need to have insert statements in an sql file especially if you have large amount of data to insert.
What you need is the values separated by a field delimiter and each record separated by a record delimiter. For these formats, you need to go through the Oracle Documentation for sqlloader.
Loading data into tables via sqlloader is much faster than processing insert statements written in an sql file and then load that into a table.
Regards,
KeshavB -
Error in running a function to convert coordinates in degrees to decimal for EXCEL VBA
For your information, I have 3 cross-posts regarding this question - and all I can said there is still no firm solution regarding this error.
1) http://stackoverflow.com/questions/27634586/error-in-running-a-function-to-convert-coordinates-in-degrees-to-decimal-for-exc/27637367#27637367
2) http://www.mrexcel.com/forum/excel-questions/826099-error-running-function-convert-coordinates-degrees-decimal-excel-visual-basic-applications.html#post4030377
3) http://www.excelguru.ca/forums/showthread.php?3909-Error-in-running-a-function-to-convert-coordinates-in-degrees-to-decimal-for-EXCEL-VB&p=16507#post16507
and the story of the error is as below:
Currently I am working on VBA excel to create a widget to verify coordinates whether it lies under the radius of ANOTHER predefined and pre-specified sets of coordinates.
In the module, I want to convert the coordinates from degrees to decimal before doing the calculation - as the formula of the calculation only allow the decimal form of coordinates.
However, each and every time I want to run the macros this error (Run-time error '5', invalid procedure call or argument) will appear. Then, the debug button will bring me to below line of coding:
degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "°") - 1))
For your information, the full function is as below:
Function Convert_Decimal(Degree_Deg As String) As Double
'source: http://support.microsoft.com/kb/213449
Dim degrees As Double
Dim minutes As Double
Dim seconds As Double
Degree_Deg = Replace(Degree_Deg, "~", "°")
degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "°") - 1))
minutes = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "°") + 2, _
InStr(1, Degree_Deg, "'") - InStr(1, Degree_Deg, "°") - 2)) / 60
seconds = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "'") + _
2, Len(Degree_Deg) - InStr(1, Degree_Deg, "'") - 2)) / 3600
Convert_Decimal = degrees + minutes + seconds
End Function
Thank you.
Your kind assistance and attention in this matter are highly appreciated.
Regards,
Nina.You didn't give an example of your input string but try the following
Sub test()
Dim s As String
s = "180° 30' 30.5""""" ' double quote for seconds
Debug.Print Deg2Dec(s) ' 180.508472222222
End Sub
Function Deg2Dec(sAngle As String) As Double
Dim mid1 As Long
Dim mid2 As Long
Dim degrees As Long
Dim minutes As Long
Dim seconds As Double ' or Long if only integer seconds
sAngle = Replace(sAngle, " ", "")
mid1 = InStr(sAngle, "°")
mid2 = InStr(sAngle, "'")
degrees = CLng(Left$(sAngle, mid1 - 1))
minutes = CLng(Mid$(sAngle, mid1 + 1, mid2 - mid1 - 1))
seconds = Val(Mid$(sAngle, mid2 + 1, 10)) ' change 10 to 2 if only integer seconds
Deg2Dec = degrees + minutes / 60 + seconds / 3600
End Function
As written the function assumes values for each of deg/min/sec are included with unit indicators as given. Adapt for your needs.
In passing, for any work with trig functions you will probably need to convert the degrees to radians. -
There was an error while updating row count for "SH".."SH".CHANNELS
Hi All,
Am new to OBIEE.Pls help in this regard.
Am building the physical layer as per Repository guide.When am importing the data in to this,am getting the below error.
*"There was an error while updating row count for "SH".."SH".CHANNELS" :"*
channles is the table name and having 5 rows.
but am able to see the data in the sql prompt. like SELECT * FROM SH.CHANNELS then 5 rows data would be displaying..
pls help in this regard and where is the excat problem?
Thanks,what is the error?
Make sure that your connection pool settings are okay..
Make sure that, you are using correct driver in case of if you are using ODBC dsn..
Also make sure that, your oracle server is running... TNS and Oracle server services -
Below expression works fine with text box but gives error in dataset expression.
="SET FMTONLY OFF select "+ join(Parameters!Column.Value,",") +" FROM pamcustom.dbo.vw_HFL_HFD_HotfileData INNER JOIN pamcustom.dbo.HFL_HFB_HotFileBatch on BatchID = HFB_intBatchID where BatchID ="+Parameters!BatchId.Value+"
and "+Parameters!cmbTranType.Value+" "+ iif(CountRows("DS_Aml_Mnr_Iss_Desc")=Parameters!Mnr_Iss_Desc.count," "," and aml_mnr_iss_desc in "+"('" & join(Parameters!Mnr_Iss_Desc.Value,"','")
& "')")+iif(CountRows("ds_ReportingCategory")=Parameters!ReportingCategory.count," "," and ReportingCategory in "+"('" & join(Parameters!ReportingCategory.Value,"','") & "')")+iif(CountRows("ds_NAICSubGroup")=Parameters!NAICSubGroup.count,"
"," and naicsubgroup in "+"('" & join(Parameters!NAICSubGroup.Value,"','") & "')")+iif(CountRows("ds_PortTrading")=Parameters!PortTrading.count," "," and porttrading in "+"('"
& join(Parameters!PortTrading.Value,"','") & "')")+iif(CountRows("ds_GL_LE")=Parameters!GL_LE.count," "," and gl_le in "+"('" & join(Parameters!GL_LE.Value,"','") &
"')")+iif(CountRows("ds_coagroup")=Parameters!cmbCoaGrp.count," "," and coagroup in "+"('" & join(Parameters!cmbCoaGrp.Value,"','") & "')")+iif(CountRows("Portfolio")=Parameters!cmbPort.count,"
"," and portfolio in "+"('" & join(Parameters!cmbPort.Value,"','") & "')")+IIf(IsNothing(Parameters!txtSecID.Value)," "," and secid in ('"+Replace(Parameters!txtSecID.Value,",","','")+"')")+iif(IsNothing(Parameters!minPortFilter.Value)
and IsNothing(Parameters!MinPort.Value)," "," and portfolio "+Parameters!minPortFilter.Value+Parameters!MinPort.Value)+iif(IsNothing(Parameters!maxPortFilter.Value) and IsNothing(Parameters!MaxPort.Value)," ","
and portfolio "+Parameters!maxPortFilter.Value+Parameters!MaxPort.Value)+iif(IsNothing(Parameters!minCoaFilter.Value) and IsNothing(Parameters!txtMinCoa.Value)," "," and portfolio "+Parameters!minCoaFilter.Value+Parameters!txtMinCoa.Value)+iif(IsNothing(Parameters!maxCoaFilter.Value)
and IsNothing(Parameters!txtMaxCoa.Value)," "," and portfolio "+Parameters!maxCoaFilter.Value+Parameters!txtMaxCoa.Value)
I guess the error " Aggregate and lookup functions cannot be used in query parameter expressions." is because I am using CountRow to ensure that if all values of multi select all selected i will not use that filter in where clause.
Pls. guide...Hi, Include your parameter total count in the dataset for parameter and instead of using countrows() function use the count from dataset in the expression.
Hope this helps.........
Ione -
Error While uploading the Function and Function_BP
Hello,
I am getting the following error while uploading the Functions and Funtions_BP using the Rule Upload functions.
com.virsa.cc.comp.Function_upload.onActionUploadFunc(Function_upload.java:302) com.virsa.cc.comp.wdp.InternalFunction_upload.wdInvokeEventHandler(InternalFunction_upload.java:150) com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87) com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67) com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420) com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132) com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335) com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143) com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:321) com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713) com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666) com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250) com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149) com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62) com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53) javax.servlet.http.HttpServlet.service(HttpServlet.java:760) javax.servlet.http.HttpServlet.service(HttpServlet.java:853) com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401) com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266) com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386) com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364) com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039) com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265) com.sap.engine.services.httpserver.server.Client.handle(Client.java:95) com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175) com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) java.security.AccessController.doPrivileged(Native Method) com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104) com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
The files which i am uploading the file from the Best practises only.
What is the reason for this error?
Did any one get this error?
Regards,
Kumar Rayudu
Edited by: Kumar Rayudu on Aug 4, 2009 12:32 PMHello Kumar,
Have you uploaded the SAP text and object files? Upload them first and then try to upload functions.
Harleen
SAP GRC RIG
Maybe you are looking for
-
ICal suddenly not syncing with iPod Touch
Up until I downloaded 2.0 for the iPod touch I haven't had any problems syncing iCal with my iPod touch. Now, nothing appears to be going back and forth. I have restored the software on my touch a couple of times; once I even had it restore the touch
-
Why does the System message-"Customer Num of customer is on hold" appear
Hi, I created a UDO form with a field named Customer Code that represents a code of a customer. Pressing TAB over the field enables to choose a customer from a list. The list is based on Choose From List system object. When I choose a customer, who
-
I need to re-download Aperture
...But all I can find are updates to 3.0. I had to do a clean install of Mavericks, so I'm having to redownload a lot of software. All of the Aperture updates require a base installation of 3.0 but I can't find it anywhere. I defintitely don't want
-
Email works but my browser fails - ideas?
My emails works fine, diagnostics says I am connected but 2 different browsers fail. Ideas?
-
Can't download on SUN site ???
Am desperatly trying to download from sun download site using direc http or SDM The result is the same: the host is not responding: http://192.18.97.133/ECom/EComTicketServlet/BEGINF132A52815C2FB7CF7B3EE7C4C9A8796/19843383/1307451699/1/699482/699338/