Ora-22905:cannot access rows from a non-nested ...(during full outer join)
Greetings Gurus,
I'm getting an ORA-22905 when I try and do a full outer join in the following function. If I include the commented lines in the perstren_diff_recs2 function I get the error. Both halfs of the union query work by themselves. When I union them bam error. Also, when I use the full outer join syntax the Oracle session craps the bed with a end of file communication error. That is why I'm using the simulated full outer join.
My goal was to abstract the XML in my queries. The results from the pipelined function is a delta between what is in the XML document and a relational base table.
Derrick
CREATE OR REPLACE PACKAGE XML_UTILS is
TYPE perstren_typ is record (
uic varchar2(6),
tpers varchar2(2),
deply varchar2(6),
secur varchar2(1),
struc number(4),
auth number(4)
TYPE perstren_diff_typ is record (
uic varchar2(6),
transaction_type char(1),
tpers varchar2(2),
deply varchar2(6),
secur varchar2(1),
struc number(4),
auth number(4)
TYPE perstrenSet is table of perstren_typ;
TYPE perstrenDiffSet is table of perstren_diff_typ;
function perstren_recs (uic varchar2) return perstrenSet pipelined;
function perstren_diff_recs2 (uic varchar2) return perstrenDiffSet pipelined;
end;
CREATE OR REPLACE PACKAGE BODY XML_UTILS is
function perstren_diff_recs2 (uic varchar2) return perstrenDiffSet pipelined is
cursor perstren_recs_cur(in_uic varchar2) is
select p.uic, p.tpers, p.deply, P.secur, p.struc,p.auth,
doc.uic as xmluic,
doc.tpers as xmltpers,
doc.deply as xmldeply,
doc.secur as xmlsecur,
doc.struc as xmlstruc,
doc.auth as xmlauth
from perstren_bac p left outer join
table(xml_utils.perstren_recs(in_uic)) doc
on (p.uic = doc.uic and
p.tpers = doc.tpers and
p.deply = doc.deply)
where p.uic = in_uic;
-- union
-- select p.uic, p.tpers, p.deply, P.secur, p.struc,p.auth,
-- doc.uic as xmluic,
-- doc.tpers as xmltpers,
-- doc.deply as xmldeply,
-- doc.secur as xmlsecur,
-- doc.struc as xmlstruc,
-- doc.auth as xmlauth
-- from perstren_bac p right outer join
-- table(xml_utils.perstren_recs(in_uic)) doc
-- on (p.uic = doc.uic and
-- p.tpers = doc.tpers and
-- p.deply = doc.deply)
-- where doc.uic = in_uic;
out_rec perstren_diff_typ;
begin
for cur_rec in perstren_recs_cur(uic) loop
if cur_rec.xmldeply is not null and cur_rec.xmltpers is not null then
out_rec.uic := cur_rec.xmluic;
out_rec.tpers := cur_rec.xmltpers;
out_rec.deply := cur_rec.xmldeply;
out_rec.secur := cur_rec.xmlsecur;
out_rec.struc := cur_rec.xmlstruc;
out_rec.auth := cur_rec.xmlauth;
else
out_rec.uic := cur_rec.uic;
out_rec.tpers := cur_rec.tpers;
out_rec.deply := cur_rec.deply;
out_rec.secur := cur_rec.secur;
out_rec.struc := cur_rec.struc;
out_rec.auth := cur_rec.auth;
end if;
if cur_rec.uic is not null and cur_rec.xmldeply is not null and cur_rec.xmltpers is not null and (
nvl(cur_rec.secur,'XX') != nvl(cur_rec.xmlsecur,'XX') or
nvl(cur_rec.struc,9999) != nvl(cur_rec.xmlstruc,9999) or
nvl(cur_rec.auth,9999) != nvl(cur_rec.xmlauth,9999)) then
out_rec.transaction_type :='U';
elsif cur_rec.uic is null and cur_rec.xmldeply is not null then
out_rec.transaction_type :='I';
elsif cur_rec.uic is not null and cur_rec.xmldeply is null then
out_rec.transaction_type :='D';
else
out_rec.transaction_type :='O';
end if;
PIPE row (out_rec);
end loop;
exception
when others then
if perstren_recs_cur%isopen then
close perstren_recs_cur;
end if;
raise;
return;
end;
function perstren_recs (uic varchar2) return perstrenSet pipelined is
cursor perstren_recs_cur(in_uic varchar2) is
select uic,
extractvalue(Column_value,'/PERSTREN/TPERS') as TPERS,
extractvalue(Column_value,'/PERSTREN/DEPLY') as DEPLY,
extractvalue(Column_value,'/PERSTREN/SECUR') as SECUR,
extractvalue(Column_value,'/PERSTREN/STRUC') as STRUC,
extractvalue(Column_value,'/PERSTREN/AUTH') as AUTH
from test_ref ref,
table(XMLSequence(extract(ref.XML_DOC,'/RasDataSet/PerstrenList/PERSTREN'))) per
where ref.uic = in_uic;
out_rec perstren_typ;
begin
open perstren_recs_cur(uic);
loop
fetch perstren_recs_cur into out_rec;
exit when not perstren_recs_cur%FOUND;
PIPE row (out_rec);
end loop;
close perstren_recs_cur;
exception
when others then
if perstren_recs_cur%isopen then
close perstren_recs_cur;
end if;
raise;
return;
end;
end;
Oracle bug when executing the query in a function
Similar Messages
-
ORA-22905: cannot access rows from a non-nested table item in Table func
I am using a table function in Oracle 8.1.7.4.0. I did declare an object type and a collection type like this:
CREATE TYPE t_obj AS OBJECT ...
CREATE TYPE t_tab AS TABLE OF t_obj;
My table function returns t_tab and is called like this:
SELECT ... FROM TABLE (CAST (my_pkg.table_fnc AS t_tab)) ...
This works pretty well as long as I run it in the same schema that owns the function and the 2 types. As soon as I run this query from another schema, I get an ORA-22905: cannot access rows from a non-nested table item error, even though I granted execute on both the types and the function to the other user and I created public synonyms for all 3 objects.
As soon as I specify the schema name of t_tab in the cast, the query runs fine:
SELECT ... FROM TABLE (CAST (my_pkg.table_fnc AS owner.t_tab)) ...
I don't like to have a schema hard coded in a query, therefore I'd like to do this without the schema. Any ideas of how to get around this error?Richard,
your 3 statements are correct. I'll go ahead and log a TAR.
Both DESCs return the same output when run as the other user. And, running the table function directly in SQL*Plus (SELECT my_pkg.table_fnc FROM dual;) also returns a result and no errors. The problem has to be in the CAST function.
Thanks for your help. -
ORA-22905: cannot access rows from a non-nested table item
Hi All,
This is the overview of the query used in the package.
select ename,empno,sal,deptno from
(select deptno from dept) a,
(select ename,empno,sal from emp1) b
where empno in (select * from table (pkg1.fun1('empno')))
and a.deptno=b.deptno
union
select ename,empno,sal,deptno from
(select deptno from dept) c,
(select ename,empno,sal from emp2) d
where empno in (select * from table (pkg1.fun1('empno')))
and c.deptno=d.deptno
Here the pkg1.fun1 will convert the string ('empno') into table form. ('empno') is the input parameter to the package and is a string of emp numbers.
compilation is successful. when this is executed the below error pops up
"ORA-22905: cannot access rows from a non-nested table item"
Is there any problem with the table function which i am using in this query
could anyone guide me to the solution.
Thanks AllI have used
CREATE OR REPLACE
type tab_num as table of number;
select * from table (cast(pkg1.fun1('empno')) as tab_num))
This throws an error during compilation itself
"PL/SQL: ORA-00932: inconsistent datatypes:expected number got varchar2 -
Oracle error ORA-22905: cannot access rows from a non-nested table item
Oracle error ORA-22905: cannot access rows from a non-nested table item
Creating a report using oracle plsql code .
Getting error ;
Oracle error ORA-22905: cannot access rows from a non-nested table item
when I am trying to pass data in clause in pl sql proc
basically I have a proc which takes 2 parameters(a and b)
proc (
P_a varchar2,
p_b varchar2,
OUT SYS_REFCURSOR
culprit code which is giving me the error and on google they say cast it but I dont know how to do it in my context
--where id in (
-- SELECT * FROM THE (SELECT p_cd_common.get_table_from_string(P_a) FROM dual)
-- union
-- SELECT * FROM THE (SELECT p_cd_common.get_table_from_string(P_b) FROM dual)
data sample returned from this :SELECT * FROM THE (SELECT p_cd_common.get_table_from_string(P_a) FROM dual)
'Abc','def',
data sample returned from this;SELECT * FROM THE (SELECT p_cd_common.get_table_from_string(P_b) FROM dual)
'fgd','fth',
Any answers ?
How to pass data in clause in a better wayWhy are you creating a duplicate post? I already asked you to post p_cd_common.get_table_from_string. In particular what is function return type and where it is declared. As I already mentioned, most likely function return type is declared in the package and therefore is PL/SQL type. And TABLE operator can only work with SQL types.
SY. -
ERROR:-22905:ORA-22905: cannot access rows from a non-nested table item
Hi. I have some code running on oracle 9i that gives me above error.
Following are my type declarations.
drop type_obj_tea_icore_glr;
drop type_tbl_tea_icore_glr;
create or replace type type_obj_tea_icore_glr as object (
ns_comp_id_parent number,
ns_comp_id_child number,
serv_item_id number,
glr_display_order number,
exchange_carrier_circuit_id varchar2(53)
show err
create or replace type type_tbl_tea_icore_glr as table of type_obj_tea_icore_glr;
show err
I have a function in an oracle package tea_icore_pkg with following signature.
FUNCTION sortpvcdesign (
p_document_number serv_req_si.document_number%TYPE,
p_pvc_serv_item_id serv_item.serv_item_id%TYPE,
p_orig_port_serv_item_id serv_item.serv_item_id%TYPE
RETURN type_tbl_tea_icore_glr
If I run following from SQL prompt, it works fine.
SELECT * FROM TABLE (tea_icore_pkg.sortpvcdesign(255082,2782636,2723752) );
But when I use that within another procedure of the same packge, as follows:
FOR glr_rec IN
(SELECT *
FROM TABLE
(CAST
(sortpvcdesign (c_pvcs.order_nbr,
c_pvcs.pvc_serv_item_id,
c_pvcs.orig_port_serv_item_id
) AS type_tbl_tea_icore_glr
LOOP
At the runtime, I got the above error message ( as referred to in subject ). I took all of the suggestions on CAST without much success. The user/schema is only one schema here. I mean, no permissions issue. I granted all on above types to public.
Can someone help?Bil,
I tried both with CAST and without CAST with specifying the colums. The same error.
OR glr_rec IN
(SELECT ns_comp_id_parent, ns_comp_id_child, serv_item_id,
glr_display_order, exchange_carrier_circuit_id
FROM TABLE
(CAST
(sortpvcdesign (c_pvcs.order_nbr,
c_pvcs.pvc_serv_item_id,
c_pvcs.orig_port_serv_item_id
) AS type_tbl_tea_icore_glr
LOOP -
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. -
Cannot access Rows from a non-nested table item..
create or replace package types
as
type cursorType is ref cursor;
end;
create or replace function sp_ListEmp
return types.cursortype
as
l_cursor types.cursorType;
begin
open l_cursor for select ename, empno from Scott.emp order by ename;
return l_cursor;
end;
=====================
Select * from Table (sp_ListEmp)
=====================
Can this Select by executed anyway without changing upper code.. I found some casting sort of solution but cannot get the exact one.. please helpOr this way:
HR%xe> select sp_listemp from dual;
SP_LISTEMP
CURSOR STATEMENT : 1
CURSOR STATEMENT : 1
LAST_NAME EMPLOYEE_ID
Abel 174
Ande 166
Atkinson 130
Austin 105
Baer 204
Baida 116
Banda 167
Bates 172
Bell 192
Bernstein 151
Bissot 129
LAST_NAME EMPLOYEE_ID
Bloom 169
Bull 185
Cabrio 187
Cambrault 154
Cambrault 148
Chen 110
Chung 188
Colmenares 119
Davies 142
De Haan 102
Dellinger 186
LAST_NAME EMPLOYEE_ID
Dilly 189
Doran 160
Ernst 104
Errazuriz 147
Everett 193
-- -
Hi when i run this query its showing an error ORA_22905 cannot access rows
hi when i run this query its showing an error ORA_22905 cannot access rows from an non nested table item can anyone help me out
SELECT
DISTINCT SERVICE_TBL.SERVICE_ID , SERVICE_TBL.CON_TYPE, SERVICE_TBL.S_DESC || '(' || SERVICE_TBL.CON_TYPE || ')' AS SERVICE_DESC ,SERVICE_TBL.CON_STAT
FROM
TABLE(:B1 )SERVICE_TBL
WHERE
CON_NUM = :B2
thanks & regardsNote the name of this forum is SQL Developer *(Not for general SQL/PLSQL questions)* (so for issues with the SQL Developer tool). Please post these questions under the dedicated SQL And PL/SQL forum.
Regards,
K. -
ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP
In my data model (load from a database) there is this data control and its accessor return.
When I drag the accessor return inside a jsf page I create a adf read only table (that has about 5000 rows), the I run the page and it works.
Since I want to display only 20 ( or 50 or 100 is the same) rows for each page I had changed the access mode from the default value "Scrollable" to "Range Paging" and then I ve selected range size 50.
Now if I run hte jsf page there are no data to display and if I press the small triangles to order the column or insert a word in the filter field I have the message ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP.
I dont know how to do to solve this problem.
StefanoAn other thing.
I solved this problem, maybe I dont understand the meaning of access mode and range size , since every value I choose of these 2 fields the visualization of the table doesnt change. -
ORA-00604: error occured at recursive SQL level 1 ORA-12705: Cannot access
Oracle Database 10g Express Edition Release 10.2.0.1.0 on
OS Linux Debian 3.1_r4_stable
SQL> select userenv('LANGUAGE') from dual;
USERENV('LANGUAGE')
RUSSIAN_RUSSIA.AL32UTF8
Client OS MS Vista Ultimate EN , region=RUSSIAN.RUSSIA
Oracle Developer suite 10
SQL-Developer
Version 1.1.0.23.
NLS_LANG=RUSSIAN_RUSSIA.CL8MSWIN1251
Oracle Developer suite 10 is working properly but when
i am attempting a connection between Oracle 10g XE and SQL-Developer.
Need some help to resolve this error message....
ORA-00604: error occured at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid enviroment specifiedHi,
You have to set NLS_LANG before connect to Oracle Database.
$export NLS_LANG=.AL32UTF8 -
Hi,
I have two tables
CUSTOMERS
===========
Name Null Type
======================
CUST_UID NOT NULL NUMBER(4)
CUST_NAME VARCHAR2(50)
ITEM_PRICES
===========
Name Null Type
======================
IP_UID NOT NULL NUMBER(4)
IP_ITEM_DESC VARCHAR2(50
IP_COST_PRICE NUMBER(6,2)
IP_SELL_PRICE NUMBER(6,2)
I have a view IPS_VW which is the cartician product of CUSTOMERS and ITEM_PRICES, and an instead of trigger for UPDATE on this view which either inserts or updates data in the following third table
ITEM_PRICES_SPECIAL
===========
Name Null Type
======================
IPS_UID NOT NULL NUMBER(4)
CUST_UID NUMBER(4)
IP_UID NUMBER(4)
IPS_SELL_PRICE NUMBER(6,2)
The following is my view
SELECT 'A'||ROWNUM AS "IPSVW_UID",
0 AS "IPSVW_IPS_UID",
"CUSTOMERS"."CUST_UID" AS "IPSVW_CUST_UID",
"ITEM_PRICES"."IP_UID" AS "IPSVW_IP_UID",
"ITEM_PRICES"."IP_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
FROM "CUSTOMERS" "CUSTOMERS",
"ITEM_PRICES" "ITEM_PRICES"
WHERE NOT EXISTS
(SELECT 1
FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL"
WHERE "ITEM_PRICES_SPECIAL"."IP_UID" ="ITEM_PRICES"."IP_UID"
AND "ITEM_PRICES_SPECIAL"."CUST_UID" ="CUSTOMERS"."CUST_UID"
UNION
SELECT 'B' ||ROWNUM AS "IPSVW_UID",
"ITEM_PRICES_SPECIAL"."IPS_UID" AS "IPSVW_IPS_UID",
"ITEM_PRICES_SPECIAL"."CUST_UID" AS "IPSVW_CUST_UID",
"ITEM_PRICES_SPECIAL"."IP_UID" AS "IPSVW_IP_UID",
"ITEM_PRICES_SPECIAL"."IPS_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL";
And this is the instead of trigger
CREATE OR REPLACE TRIGGER "TRG_IPSVW_UPDATE" INSTEAD OF
UPDATE ON IPS_VW REFERENCING NEW AS N FOR EACH ROW
BEGIN
IF :N.IPSVW_IPS_UID = 0 THEN
INSERT INTO ITEM_PRICES_SPECIAL
( CUST_UID, IP_UID,IPS_SELL_PRICE )
VALUES
( :N.IPSVW_CUST_UID,:N.IPSVW_IP_UID, :N.IPSVW_IPS_SELL_PRICE );
ELSE
UPDATE ITEM_PRICES_SPECIAL
SET IPS_SELL_PRICE = :N.IPSVW_IPS_SELL_PRICE
WHERE IPS_UID = :N.IPSVW_IPS_UID;
END IF;
END;
Everything works fine in SQLPLUS, if i update a rate in this view, a record is either inserted or updated in the third table.
But when i try to create a tabular form based on this view, i get the error
ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
Could someone help me please?
Thanks,
AllenI think The tabular form needs to be able to identify some primary key and using a rownum concatenation cannot provide that.
Cheers
Kofi -
What causes "ORA-01445: cannot select ROWID from" error
While executing a SELECT query i got this error:
ORA-01445: cannot select ROWID from, or sample, a join view without a
key-preserved table
Below mentioned is the join condition part of the query. The line which the error has occured is italicized
from checkout_hdtl ch
inner join pmt_htl ph on ph.post_ln_a = ch.post_ln_code
inner join pin_dls pd on pd.post_ln_a = ph.post_ln_code
inner join carton_dtl cd on cd.carton_nbr = ch.carton_nbr
and cd.lseq_nbr = pd.lseq_nbr
inner join invoice_module im on cd.invevt_code = im.inv_code
inner join item_dock_master del on nm.invent_code = iwm.inv_code
left outer join inv_curr_comm_code mnb on ium.invent_code = im.inv_code
and icc.cntry = ph.shipto_cntry
left outer join vw_ver_master vw on vw.del_rec = ch.del_rec
left outer join cmd code_entry on code_pi.cntry =
cd.code_entry where ch.shpmt_nbr = '3'
What do i do?I would rather use Notepad than store my data in SQL server. It just so happens that our product is released for SQL Server as well. Hence i did the testing.
>Is there a limit to the number of joins that can be performed in Oracle?
Wrong question as it does not have anything to do with the number of views.. it has everything to do with the ability to correctly identify the unique row. Re-read the error message details posted by Blu - it explains the error.As you can see from my post, i created a table using the(CTAS) SELECT query from the View vw_ver_master's definition. So the view's result set is now stored in a table and now there are only tables involved in these JOINS.
The query will succeed if i comment out ANY one of these JOINS in this statement. This is so weird.
I -
ORA-12705: Cannot access NLS data files or invalid environment specified
Hi,
I am using Oracle 10g Express, ojdbc14.jar , apache tomcat 5 server on Linux (Fedora 6).
In CustDisp.JSP I have following code:
<%
try {
Class.forName ("oracle.jdbc.driver.OracleDriver").newInstance();
out.println("JDBC driver loaded.<br>");
catch (ClassNotFoundException e) {
%>
error :<br>
<%=e.toString() %>
<%
String sql = "SELECT custid, fname, lname FROM customers";
try {
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","myid", "mypassword");
out.println("Connection made.<br><br>");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sql);
%>
When Itry to access http://localhost:8080/jsps/CustDisp.jsp,I get following error:
java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified.
When I display enviorenment parameters in this JSP, I get follwing:
JDBC driver loaded.
Oracle Home = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server
Language = en_US.UTF8
NLS Language = AMERICAN_AMERICA.AL32UTF8
Path = /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
Class Path = /usr/lib/jvm/java/lib/tools.jar:/usr/share/tomcat5/bin/bootstrap.jar:/usr/share/tomcat5/bin/commons-logging-api.jar:/usr/share/java/mx4j/mx4j-impl.jar:/usr/share/java/mx4j/mx4j-jmx.jar
Charset = null
Home = /usr/share/tomcat5
Log Name = tomcat
LD LIB PATH = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nls/data/ojdbc14.jar:
Locale = en_US
nls data directory : /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nls/data
I have checked permissions for nls data folder, they are :
Owner: Oracle
Folder Access: Create and delete files
Group: Dba
Folder Access: Access files
Others
Folder Access: Access files
Execute: Allow executing file as program.
I have written a java program and used same drivers,customers table and connection i.e
Class.forName ("oracle.jdbc.driver.OracleDriver").newInstance();
String sql = "SELECT custid, fname, lname FROM customers";
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","myid", "mypassword");
it works fine and displays customers.
Only when I try to access my CustDisp.JSP, I get
java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified. Error.
Can some one please help me sorting out this problem?
Thanks in advance.
AQKHi,
Relevant code for CustDisp.JSP is given below:
<%@ page session="false" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="oracle.jdbc.*" %>
<%
try {
Class.forName ("oracle.jdbc.driver.OracleDriver").newInstance();
out.println("JDBC driver loaded.<br>");
catch (ClassNotFoundException e) {
%>
error :
<%=e.toString() %>
<%
String sql = "SELECT custid, fname, lname FROM customers";
try {
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","myid", "mypassword");
out.println("Connection made.<br><br>");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sql);
%>
Permissions for nls data folder
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nls/data/
are :
Owner: Oracle
Folder Access: Create and delete files
Group: tomcat
Folder Access: Access files
Others
Folder Access: Access files
Execute: Allow executing file as program.
In CustDisp.JSP I have following code which accesses ojdbc14.jar
// Check access to the nls data files.
cfile = "";
try{
File myfile = new File("/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nls/data/ojdbc14.jar");
if (myfile.exists() == true){
cfile="ojdbc14.jar exists in the data directory. Its length is "+ myfile.length()+" It can be read =" myfile.canRead() " , can be written = " + myfile.canWrite();
}else{
cfile="ojdbc14.jar does not exist.";
catch (Exception er){
%>
error in reading file:<br>
<%=er.toString() %>
<%
This code gives following output:
File ojdbc14.jar exists in the data directory. Its length is 1536979 It can be read =true , can be written = false
Every things seems to be OK but when I try to access http://localhost:8080/jsps/CustDisp.jsp, Iget:
Sql Error:
java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified
Best regards.
AQK -
ORA-01445: cannot select ROWID from, or sample, a join view without a key-p
Hi All,
I am facing issue with one sql query. It is giving me error:
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table
I am not getting any clue to solve this. On internet, i didn't find proper reason for this error and troubleshooting way and solution for this error. Everywhere i saw one sentence, "Key preserved means the row from the base table will appear AT MOST ONCE in the output view on that table" but it didn't solve my problem.
I have 1099 columns in one select query. so avoiding the actual column list in select clause. Instead I am trying to select ROWIDs from all tables in join. My understanding is ROWID is a unique identifier in table not in database. But though I remove ROWIDs, I get same error. So please don't bother about these ROWIDs.
SELECT
TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD')
,FACT.ROWID AS ABC1
,FACT_ADJ.ROWID AS ABC2
,DIM_SEC.ROWID AS ABC3
,DIM_SEC_ADJ.ROWID AS ABC4
,DIS_CAT.ROWID AS ABC5
,CTRY.ROWID AS ABC6
,BCP.ROWID AS ABC7
,STAGE.ROWID AS ABC8
FROM FACT_POSITION FACT
LEFT JOIN FACT_POSITION_ADJ FACT_ADJ ON FACT.POSITION_PKID = FACT_ADJ.POSITION_FKID
LEFT JOIN DIM_SOURCE_SYSTEM SOURCE ON FACT.SOURCE_SYSTEM_FKID = SOURCE.SOURCE_SYSTEM_PKID
LEFT JOIN DIM_SECURITY DIM_SEC ON FACT.SUBSYS_SECURITY_FKID = DIM_SEC.SECURITY_PKID
LEFT JOIN DIM_SECURITY_ADJ DIM_SEC_ADJ ON FACT.SUBSYS_SECURITY_FKID = DIM_SEC_ADJ.SECURITY_PKID
LEFT JOIN DIM_DISCLOSURE_CATEGORY DIS_CAT ON FACT.DISCLOSURE_CATEGORY_FKID = DIS_CAT.DISCLOSURE_CATEGORY_PKID
LEFT JOIN COUNTRY_REFERENCE CTRY ON CTRY.DESCRIPTION = DIM_SEC.ISSUER_COUNTRY
LEFT JOIN BUSINESS_CLOSE_PERIOD BCP
ON BCP.BUSINESS_CLOSE_DATE = ADD_MONTHS(TRUNC(TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD'),'MM'), 1) -1
AND BCP.IS_LOCKED='Y' AND BCP.IS_ACTIVE='Y'
LEFT JOIN GUI_STAGING STAGE ON
FACT.POSITION_PKID=STAGE.POSITION_PKID
AND STAGE.IS_ACTIVE='Y'
AND STAGE.STATUS_ID IN(12,8,1,2,3,4,5)
WHERE FACT.POSITION_PKID=64524374;
While trying to sort this error, I found interesting things that made me more confused.
if I remove TO_DATE function from select clause, same join query works.
If I remove any table from join and keep TO_DATE function in select clause, query works.
That tells, there is no problem in query.
Then please anyone help me to sort out the error. FYI. I have googled a lot for this error. but didn't get solution/clue. That is why I am posting this problem to forum.
Thanks in advance. waiting for reply ASAP.
Pravin Pujari
[email protected]I think i got the solution. The syntax i was using (ANSI syntax) doesn't work in the oracle database version i am using.
When i updated my query with older oracle syntax, it worked.
SELECT
TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD')
,FACT.ROWID AS ABC1
,FACT_ADJ.ROWID AS ABC2
,SOURCE.ROWID AS ABC3
,DIM_SEC.ROWID AS ABC4
,DIM_SEC_ADJ.ROWID AS ABC5
,DIS_CAT.ROWID AS ABC6
,CTRY.ROWID AS ABC7
,BCP.ROWID AS ABC8
,STAGE.ROWID AS ABC8
FROM [email protected] FACT
,[email protected] FACT_ADJ
,[email protected] SOURCE
,[email protected] DIM_SEC
, [email protected] DIM_SEC_ADJ
, [email protected] DIS_CAT
, GUI.COUNTRY_REFERENCE CTRY
, GUI.BUSINESS_CLOSE_PERIOD BCP
, GUI.GUI_STAGING STAGE
WHERE FACT.POSITION_PKID=64517140
AND FACT_ADJ.POSITION_FKID(+) = FACT.POSITION_PKID
AND SOURCE.SOURCE_SYSTEM_PKID=FACT.SOURCE_SYSTEM_FKID
AND DIM_SEC.SECURITY_PKID=FACT.SUBSYS_SECURITY_FKID
AND DIM_SEC_ADJ.SECURITY_PKID(+)=DIM_SEC.SECURITY_PKID
AND FACT.DISCLOSURE_CATEGORY_FKID = DIS_CAT.DISCLOSURE_CATEGORY_PKID
AND CTRY.DESCRIPTION = DIM_SEC.ISSUER_COUNTRY
AND BCP.BUSINESS_CLOSE_DATE = ADD_MONTHS(TRUNC(TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD'),'MM'), 1) -1
AND BCP.IS_ACTIVE='Y'
AND FACT.POSITION_PKID=STAGE.POSITION_PKID
AND STAGE.IS_ACTIVE='Y'
AND STAGE.STATUS_ID IN(12,8,1,2,3,4,5); -
[exec] ORA-12705: Cannot access NLS data files or invalid environment specified
Hi all,
We have an app running ok on WinXP, But if run on Win7 it gets error:
[exec] Caused by: java.sql.SQLException: ORA-00604: error occurred at recur
sive SQL level 1
[exec] ORA-12705: Cannot access NLS data files or invalid environment speci
fied
Is this a sqlnet client issue?
Thanks a lot,
zxyyxes2013 wrote:
I already google it but I am not confident about my result
I need validation from genius guys like you
And as long as you rely on being spoon-fed everything, you will never be confident about your result.
Try the following:
>change jre versión (donwload from http:www.sun.com) and declare the new JAVA_HOME variable.
>try calling this code: Locale.setDefault(Locale.ENGLISH);
before you open a database connection.
> The NLS_LANG must be unset in the Windows registry (re-named is best). Look for the NLS_LANG subkey in the registry at \HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, and rename it.
And where did you find that solution?
Lie On The Internet - YouTube
Maybe you are looking for
-
Details on dependencies of Software components(Sc's)
Hi Gurus, Can you explain me indetail what are dependencies and what is the function of each of them: sap-jee sap_built sap_jtech and sappcui_gp and what are .sca files, i am totally confused. one more issue is in my track the above dependencies(sap-
-
I am new to the JDBC API, but I am trying to create a connection to Oracle 11i through JDBC in a Servlet's init() methid. The problem is that I don't seem to be entering my init() method. I get a NullPointerException when I attempt to reference the C
-
Can't print from my Power PC os x 10.4.11 to Sharp MX3501N
I am not able to print to the Sharp MX3501N from my Power PC G5 with the os x 10.4.11 operating system. It spools to the printer, but won't print. Anyone have a similar problem and if so figure out what the problem was?
-
Scale won't reset to 100 percent in print window
How do I get the scale to change and remain at the selected setting in the print window? On one of our User accounts it is stuck at 300%. I can change it for one printing but when the print window is opened again the scale reverts to 300%. On all oth
-
Error importing HCM project in txn SXDA
According to the "Quick Guide to Installing the SAP Best Practices for Human Capital Management (US)", step 2.4, I am to use transaction SXDA to upload a project which has been extracted from Note 1060029. When I do so, I get the error: File C:\usr\