Create a view problem on nested tables
I have a table which has a column of nested table:
create table Person (
id NUMBER(10), --primary key
attr1 varchar2(10),
attr2 varchar2(10),
kids KIDS_NT --KIDS_NT is a nested table of object
--which has two columns: name, age.
) nested table store as kids_nt_tab;
Now I like to create a view which has the id (key), concatenation of attr1 and attr2 with a ".", and count of how many kids this persion has):
create view Person_V as (
select id, attr1||'.'||attr2 as attr12,
count(*) from A a, table(a.kids)
group by id)
This won't work since it says attr1.attr2 is not a GROUP BY expression. If I don't specify a group by statement, it will say "not a single group group function).
One solution that I think it will work but quite ugly is to create a view of id and attr1.attr2, andother for id and kids count, then a final view to join them.
Does anyone have a better solution? Thanks in advance!
Alice
One way could be:
SQL> create or replace type kids as object (
2 name varchar2(10),
3 age number) ;
4 /
Type created.
SQL>
SQL> create or replace type kids_nt as table of kids ;
2 /
Type created.
SQL>
SQL> create table Person (
2 id NUMBER(10) primary key,
3 attr1 varchar2(10),
4 attr2 varchar2(10),
5 kids KIDS_NT
6 ) nested table kids store as kids_nt_tab;
Table created.
SQL>
SQL> insert into Person values (1, 'attr1', 'attr2', kids_nt(kids('kid1', 10), kids('kid2', 8))) ;
1 row created.
SQL> insert into Person values (2, 'attr1', 'attr2', kids_nt(kids('kid1', 6), kids('kid2', 13))) ;
1 row created.
SQL>
SQL> select id, attr1||' '||attr2, (select count(*) cnt from table(p.kids)) cnt
2 from Person p
3 /
ID ATTR1||''||ATTR2 CNT
1 attr1 attr2 2
2 attr1 attr2 2
2 rows selected.
SQL>
Similar Messages
-
Can we create a view involving a standard table and a ZTable ?
Hi,
I created a view based on 2 tables : EKKO and a Ztable having EBELN field in common.
Now, when i try to create a PO in ME21N , this view should get updated.But,It doesn't happen so.
So i want to confirm that is it not possible to create a view on a Ztable...
Also can anyone suggest any other option to do so...Hi,
Yes you can create a view using a standard view using a standard Data base table and a custom data base table. But this getting updated would not be done by the standard program of Tcode ME21N, I reckon you need to write the logic of updation in an enhancement.
Regards,
Murthy. -
Problem creating a view in Administrator: 942: table or view does not exist
Hi and thank you for reading,
I am working with the Administration tool and would like to create a view in the physical layer. However I am getting the following error messages when I try to view the Date in the view:
[NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occured.
[nQSError: 43093] An error occured while processing the EXECUTE PHYSICAL satement.
*[nQSError: 17001] Oracle Error code: 942, message: ORA-00942: table or view does not exist at OCI call OCIStmtExecute.*
[nQSError: 17010] SQL statement preparation failed.
[NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occured.
[nQSError: 43093] An error occured while processing the EXECUTE PHYSICAL satement.
*[nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute.*
[nQSError: 17010] SQL statement preparation failed.
I proceed as following:
Right click on a physical schema (this schema is already created and works in Answers) -> new Physical Schema ->Table Type: Select -> Select * from Table_A where name='name' (Table_A is in the physical schema) -> OK -> Save -> Deploy -> Update Row count (works) -> View Data -> Error
Any Idea what I am doing wrong. I have started with an easy select statement to test how to create a view in Oracle Administrator.
Thanks a lot for any help
EvgenyDo you see Table_A, and in which database schema?
Try to put alias (database user) before table name.
Select * from user.Table_A where name='name'
Where user is database user.
If you have Table_A in another user and connection pool is set to different user, then grant select from Table_A owner to connection pool user (make synonym for Table_A):
Example (I'm using connection pool from userB and have tables from userA and userB).
create or replace public synonym xx for userA.xx
and
grant select on xx to userB
Hope this helps.
Regards,
Goran
http://108obiee.blogspot.com -
When selecting a row from a view with a nested table I want just ONE entry returned
Does a nested table in a view "EXPLODE" all values ALWAYS no matter the where clause for the nested table?
I want to select ONE row from a view that has columns defined as TYPE which are PL/SQL TABLES OF other tables.
when I specify a WHERE clause for my query it gives me the column "EXPLODED" with the values that mathc my WHERE clause at the end of the select.
I dont want the "EXPLODED" nested table to show just the entry that matches my WHERE clause. Here is some more info:
My select statement:
SQL> select * from si_a31_per_vw v, TABLE(v.current_allergies) a where a.alg_seq
=75;
AAAHQPAAMAAAAfxAAA N00000 771 223774444 20 GREGG
CADILLAC 12-MAY-69 M R3
NON DENOMINATIONAL N STAFF USMC N
U
E06 11-JUN-02 H N
05-JAN-00 Y Y
USS SPAWAR
353535 USS SPAWAR
SI_ADDRESS_TYPE(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NUL
L, NULL)
SI_ADDRESS_TAB()
SI_ALLERGY_TAB(SI_ALLERGY_TYPE(69, 'PENICILLIN', '11-JUN-02', NULL), SI_ALLERGY
TYPE(74, 'SHELLFISH', '12-JUN-02', NULL), SIALLERGY_TYPE(68, 'PEANUTS', '13-J
UN-02', NULL), SI_ALLERGY_TYPE(75, 'STRAWBERRIES', '13-JUN-02', NULL))
SI_ALLERGY_TAB()
75 STRAWBERRIES 13-JUN-02
*******Notice the allergy entry of 75, Strawberries, 13-JUN-02 at the
end. This is what I want not all the other exploded data.
SQL> desc si_a31_per_vw
Name Null? Type
........ Omitted uneeded previous column desc because of metalink
character limit but the view is bigger then this.......
DEPT_NAME VARCHAR2(20)
DIV_NAME VARCHAR2(20)
ADDRESSES SI_ADDRESS_TAB
CURRENT_ALLERGIES SI_ALLERGY_TAB
DELETED_ALLERGIES SI_ALLERGY_TAB
SQL> desc si_allergy_tab
si_allergy_tab TABLE OF SI_ALLERGY_TYPE
Name Null? Type
ALG_SEQ NUMBER
ALG_NAME VARCHAR2(50)
START_DATE DATE
STOP_DATE DATE
SQL> desc si_allergy_type
Name Null? Type
ALG_SEQ NUMBER
ALG_NAME VARCHAR2(50)
START_DATE DATE
STOP_DATE DATECan you explain what do you mean by the following?
"PL/SQL tables (a.k.a. Index-by tables) cannot be used as the basis for columns and/or attributes"There are three kinds of collections:
(NTB) Nested Tables
(VAR) Varrying Arrays
(IBT) Index-by Tables (the collection formerly known as "PL/SQL tables")
NTB (and VAR) can be defined as persistent user defined data types, and can be used in table DDL (columns) and other user defined type specifications (attributes).
SQL> CREATE TYPE my_ntb AS TABLE OF INTEGER;
SQL> CREATE TABLE my_table ( id INTEGER PRIMARY KEY, ints my_ntb );
SQL> CREATE TYPE my_object AS OBJECT ( id INTEGER, ints my_ntb );
/IBT are declared inside stored procedures only and have slightly different syntax from NTB. Only variables in stored procedures can be based on IBT declarations.
CREATE PROCEDURE my_proc IS
TYPE my_ibt IS TABLE OF INTEGER INDEX BY BINARY_INTEGER; -- now you see why they are called Index-by Tables
my_ibt_var my_ibt;
BEGIN
NULL;
END;That sums up the significant differences as it relates to how they are declared and where they can be referenced.
How are they the same?
NTB and VAR can also be (non-persistently) declared in stored procedures like IBTs.
Why would you then ever use IBTs?
IBTs are significantly easier to work with, since you don't have to instantiate or extend them as you do with NTB and VAR, or
Many other highly valuable PL/SQL programs make use of them, so you have to keep your code integrated/consistent.
There's a lot more to be said, but I think this answers the question posed by Sri.
Michael -
I am trying to make a nested table receive an arbitrary number of values (from a shuttle) through a loop, and then insert the table into a table of nested table in my database. The problem I am having is that when I try to insert more than one value into the nested table, it will only insert the last item in the loop into the database. Thanks in advance.
This is the code I used to create my objects:
create or replace type OUTPUT_TY as object( ATTRIBUTE_ID Number(8) )
create or replace type OUTPUTS_NT as table of OUTPUT_TY
This is my actual code in ApEx:
declare
temp_NT OUTPUTS_NT;
temp_TY OUTPUT_TY;
temp Number(10);
l_vc_arr2 htmldb_application_global.vc_arr2;
begin
temp_nt := outputs_nt();
l_vc_arr2 := HTMLDB_UTIL.string_to_table (:P2_SHUTTLE, ':');
FOR i IN 1 .. l_vc_arr2.COUNT
LOOP
temp_ty := output_ty(l_vc_arr2(i)) ;
temp_NT:= outputs_nt(temp_ty);
END LOOP;
INSERT INTO OUTPUT_TEST values (temp_NT);
commit;
end;> temp_NT:= outputs_nt (temp_ty);You are not extending the nested table / collection, you are simply assigning an entirely new collection to it for each element of l_vc_arr2.
Try something like...
FOR i IN 1 .. l_vc_arr2.COUNT LOOP
temp_ty := output_ty (l_vc_arr2 (i));
temp_nt.EXTEND;
temp_nt (temp_nt.LAST) := temp_ty;
END LOOP;Or perhaps more succintly...
FOR i IN 1 .. l_vc_arr2.COUNT LOOP
temp_nt.EXTEND;
temp_nt (temp_nt.LAST) := output_ty (l_vc_arr2 (i));
END LOOP; -
Can I create a view based on two tables that have the same column name?
I have two tables A and B. Each table has 50+ columns.
I want to create a view that includes all the columns in A and all the columns in B. I created a view with a select statement that says
Select A.*, B.*
From A, B
where A.id = B.id
It returns an error because in each table I have a column that keeps track if a record has been changed called Modified_By. That's where it chokes up on I figure. I would like to write the view without explicitly writing each column name from A and B as part of the select statement. The actual select statement works fine and only bombs when trying to turn the select statement into a view.You will have to type the full column list at least once. You can save a few keystrokes (i.e. alias. on every column) by providing the column names to the CREATE part instead of in the SELECT part. Something like:
SQL> desc t
Name Null? Type
ID NUMBER
NAME VARCHAR2(10)
SQL> desc t1
Name Null? Type
T_ID NUMBER
LOC_ID NUMBER
NAME VARCHAR2(15)
SQL> CREATE VIEW t_v (id, t_name, t_id, loc_id, t1_name) AS
2 SELECT t.*, t1.*
3 FROM t, t1
4 WHERE t.id = t1.t_id;
View created.HTH
John -
Query to create a view using the following tables
Hi,
I am struggling to write the proper query to create a view using three tables.
I would really be thankful if anyone can help me.
I am pasting the following script to create the required tables and also insert appropriate data in each of the table.
create table HR.STUDENT_DETAILS (
STUDENT_ID NUMBER(10),
STUDENT_NAME VARCHAR2(50),
DOB DATE,
SEX CHAR(1),
ACTIVE CHAR(1),
CONTACT_NUMBER NUMBER(20),
primary key(STUDENT_ID)
create table HR.PAYMENT_HEADER (
PAY_HEADER_ID NUMBER(10),
DOC_NUM NUMBER(5),
MONTH_NAME VARCHAR2(10),
primary key(PAY_HEADER_ID)
create table HR.PAYMENT_DETAILS (
HEADER_ID NUMBER(10),
LINE_ID NUMBER(10),
STUDENT_ID NUMBER(10),
CUM_AMOUNT NUMBER(10),
primary key(HEADER_ID,LINE_ID)
INSERT ALL
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1112,'James','17-JUN-05','M','Y',23674378)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1113,'David','21-SEP-05','M','Y',24565457)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1114,'Michael','13-JAN-06','M','Y',25436784)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1115,'Joseph','03-JAN-06','M','Y',23435673)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1116,'Juliet','21-MAY-05','F','Y',23234527)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1117,'Monica','25-JUN-05','F','Y',24873245)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1118,'William','05-FEB-05','M','Y',23623245)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1119,'Karen','07-FEB-06','F','Y',26757543)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1120,'Erika','17-AUG-05','F','Y',25435465)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1121,'Noah','16-AUG-05','M','Y',23457645)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1122,'Angelina','28-SEP-05','F','Y',26456787)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1123,'Gabriela','30-SEP-05','F','Y',29767543)
INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1124,'Sofia','07-MAR-06','F','Y',27656578)
SELECT * FROM DUAL;
INSERT ALL
INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (305,1,'JAN')
INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (306,2,'FEB')
INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (307,3,'MAR')
INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (308,4,'APR')
INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (309,5,'MAY')
SELECT * FROM DUAL;
INSERT ALL
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,12,1112,40)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,13,1113,40)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,14,1114,40)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,15,1112,80)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,16,1113,80)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,17,1114,80)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,18,1115,40)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,19,1116,40)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,20,1112,120)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,21,1113,120)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,22,1114,120)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,23,1115,80)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,24,1116,80)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,25,1117,40)
INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,26,1118,40)
SELECT * FROM DUAL;
The above table STUDENT_DETAILS stores the details of all the students and each student has a unique student id.
Another table PAYMENT_HEADER saves the payment details as a document for each month which has a header id.
In the PAYMENT_DETAILS table, payment details are stored for the students (who made the payment for that month). This table does not save the data for a student if he has not paid on that month. This table is connected to the PAYMENT_HEADER table through a header Id.
The view should be such that when I pass the document number, it shall show the names of all the students, but shall show payment amount only for those students who had paid under the selected document number, for other it should show null.
I tried the following query:
select * from (
select sd.student_name,sd.DOB,sd.sex,sd.contact_number,pd.doc_num,pd.month_name,pd.cum_amount
from hr.student_details sd left join
(select hdr.doc_num,hdr.month_name,det.student_id,det.cum_amount
from hr.payment_header hdr, hr.payment_details det
where hdr.pay_header_id = det.header_id) pd on sd.student_id = pd.student_id)
But when I pass the filtering values like document number, it does not show some students with null values.
select * from (
select sd.student_name,sd.DOB,sd.sex,sd.contact_number,pd.doc_num,pd.month_name,pd.cum_amount
from hr.student_details sd left join
(select hdr.doc_num,hdr.month_name,det.student_id,det.cum_amount
from hr.payment_header hdr, hr.payment_details det
where hdr.pay_header_id = det.header_id) pd on sd.student_id = pd.student_id)
where doc_num = 1 or doc_num is null;
My requirement is that, every time I use a document number in the where clause for the view it should show the paid amount against the student names who has paid on that month and for all other student it should null. Total student number is 13. So every time it should show 13 students only even when I pass document No 2 or 3.
Seeking your help.
Regards
HawkerHi Frank,
as per your advice, I am omitting the 'DOB', 'GENDER','ACTIVE','CONTACT_NUMBER' fields from the 'STUDENT_DETAILS' table.
I shall create separate tables and insert the desired output from the view for each where clause.
First let us create three tables each for the desired out put:
1) For the desired output I want to see when I pass doc_num as 1
create table HR.SDT_PAY_DET_DOC_ONE (
STUDENT_ID NUMBER(10),
STUDENT_NAME VARCHAR2(50),
DOC_NUM NUMBER(5),
C_AMOUNT NUMBER(10),
primary key(STUDENT_ID)
2) For the desired output I want to see when I pass doc_num as 2
create table HR.SDT_PAY_DET_DOC_TWO (
STUDENT_ID NUMBER(10),
STUDENT_NAME VARCHAR2(50),
DOC_NUM NUMBER(5),
C_AMOUNT NUMBER(10),
primary key(STUDENT_ID)
3) For the desired output I want to see when I pass doc_num as 3
create table HR.SDT_PAY_DET_DOC_THREE (
STUDENT_ID NUMBER(10),
STUDENT_NAME VARCHAR2(50),
DOC_NUM NUMBER(5),
C_AMOUNT NUMBER(10),
primary key(STUDENT_ID)
Now I shall insert values in each of the above three tables:
INSERT ALL
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',1,40)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',1,40)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',1,40)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
SELECT * FROM DUAL;
INSERT ALL
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',2,80)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',2,80)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',2,80)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',2,40)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',2,40)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',null,null)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',null,null)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
SELECT * FROM DUAL;
INSERT ALL
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',3,120)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',3,120)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',3,120)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',3,80)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',3,80)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',3,40)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',3,40)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
SELECT * FROM DUAL;
Thanks & Regards
Hawker -
Create materialized view in SE referring table in EE
Hi DBAs,
I am trying to create a Materialized view on Oracle 10g Standard Edition which is installed on Linux Debian Lenny.
The master table is on Oracle 10g Enterprise Edition installed on Red Hat Linux 4.1.2.
When I run,
create materialized view t1 build immediate refresh fast as (select * from aksharaemsmigrated.t1@db102)
i get,
ORA-12028: materialized view type is not supported by master site
When I run,
create materialized view t1 build immediate refresh fast on commit as (select * from aksharaemsmigrated.t1@db102);
I get,
ORA-01031: insufficient privileges
When I run,
select * from aksharaemsmigrated.t1@db102
I get,
the rows from aksharaemsmigrated.t1@db102
NOTE: 'db102' is remote DB on 10g EE for which I created db link.
I am able to create Mview for local table.
Is this not supported? I mean creating Mview on Oracle SE referring base table from Oracle EE.
I have to give solution soon. Can you please throw some light.
Regards,
VijayDon't put select statement inside parantheses.
Test these
create table x1 as select * from aksharaemsmigrated.t1@db102;
create materialized view t1 build immediate refresh fast as select * from aksharaemsmigrated.t1@db102 ;Note that you cannot create an MV that is REFRESH ON COMMIT when across Databases.
See my explanation at http://hemantoracledba.blogspot.com/2008/06/mvs-with-refresh-on-commit-cannot-be.html
Hemant K Chitale -
How to create XMLTYPE View from the XMLType table
Hi:
I have a large XML file and inserted to the XMLTYPE table
For the XQUERY purpose I would like to create XMLView of the table.
The examples I got from Oracle to create XML view are for small files.
Can some one help me how to create XMLType VIEW for large XML Files ( 20,000 lines )?
Ali_2Have a look at the examples given on XMLType Views (based on relational tables) or standard views (based on XMLType storage) in the FAQ url located on the main page of this forum site regarding XMLDB.
-
Creating a type having a nested table of that type !!!!!
Hi all, my question may look ambigious, but it's better understood by this example: How can i do this??
CREATE TYPE MaterialType AS OBJECT (
MaterialID NUMBER,
MaterialName varchar2(20),
CompatibleMaterials MaterialsNT
CREATE TYPE MaterialsNT AS TABLE OF REF MaterialType;
In other words, how can i create 'MaterialType', having as attribute 'CompatibleMaterials', which is a nested table of 'MaterialType'why don't you try nested tables?
prem -
How to create dynamic View Object and Dynamic Table
Dear ll
I want to create a dynamic view object and display the output in a dynamic table on the page.
I am using Jdeveloper 12c "Studio Edition Version 12.1.2.0.0"
This what I did:
1- I created a read only view object with this query "Select sysdate from dual"
2- I added this View object to the application module
3- I created a new method that change the query of this View object at runtime
public void changeVoQuery(String dbViewName) {
String sqlstm = "Select * From " + dbViewName;
ViewObject dynamicVo = this.findViewObject("DynamicVo");
if (dynamicVo != null) {
dynamicVo.remove();
dynamicVo = this.createViewObjectFromQueryStmt("DynamicVo", sqlstm);
dynamicVo.executeQuery();
4- I run the application module for testing the method and I passed "Scott.Emp" as a parameter and the result was Success
5- Now I want to show the result of the view on the page, so I draged and dropped the method from the data control as a parameter form
6- I dragged and dropped the view Object "DynamicVo" as a table and I choose "generate Column Dynamically at runtime". This is the page source
<af:panelHeader text="#{viewcontrollerBundle.SELECT_DOCUMTN_TYPE}" id="ph1">
<af:panelFormLayout id="pfl1">
<af:inputText value="#{bindings.dbViewName.inputValue}" label="#{bindings.dbViewName.hints.label}"
required="#{bindings.dbViewName.hints.mandatory}"
columns="#{bindings.dbViewName.hints.displayWidth}"
maximumLength="#{bindings.dbViewName.hints.precision}"
shortDesc="#{bindings.dbViewName.hints.tooltip}" id="it1">
<f:validator binding="#{bindings.dbViewName.validator}"/>
</af:inputText>
<af:button actionListener="#{bindings.changeVoQuery.execute}" text="changeVoQuery"
disabled="#{!bindings.changeVoQuery.enabled}" id="b1"/>
</af:panelFormLayout>
</af:panelHeader>
<af:table value="#{bindings.DynamicVo.collectionModel}" var="row" rows="#{bindings.DynamicVo.rangeSize}"
emptyText="#{bindings.DynamicVo.viewable ? 'No data to display.' : 'Access Denied.'}"
rowBandingInterval="0" selectedRowKeys="#{bindings.DynamicVo.collectionModel.selectedRow}"
selectionListener="#{bindings.DynamicVo.collectionModel.makeCurrent}" rowSelection="single"
fetchSize="#{bindings.DynamicVo.rangeSize}" filterModel="#{bindings.DynamicVoQuery.queryDescriptor}"
queryListener="#{bindings.DynamicVoQuery.processQuery}" filterVisible="true" varStatus="vs" id="t1"
partialTriggers="::b1">
<af:iterator id="i1" value="#{bindings.DynamicVo.attributesModel.attributes}" var="column">
<af:column headerText="#{column.label}" sortProperty="#{column.name}" sortable="true" filterable="true"
id="c1">
<af:dynamicComponent id="d1" attributeModel="#{column}"
value="#{row.bindings[column.name].inputValue}"/>
</af:column>
</af:iterator>
</af:table>
when I run the page this error is occured
<Nov 13, 2013 2:51:58 PM AST> <Error> <oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter> <BEA-000000> <ADF_FACES-60096:Server Exception during PPR, #1
javax.el.ELException: java.lang.NullPointerException
Caused By: java.lang.NullPointerException
Can any body help me please
thanksHave you seen Shay's video https://blogs.oracle.com/shay/entry/adf_faces_dynamic_tags_-_for_a
All you have to do is to use the dynamic table to get your result.
Timo -
Creating maintainance view for a customising table
Hello Team,
I have a scenario where we have to create a maintainance view for a standard customising table. But all changes to entries for customising tables will prompt for a transportable change request. How to switch off this prompt for change request? Please let me know your views on this.
Thanks!create a maintainance view for a standard customising table
Doing that wont be a good idea.
If you only want to disable the transport request in a production system, then call transaction SOBJ. Give the name of the object = the maintenace view, set the "[Current Settings|http://help.sap.com/saphelp_glossary/en/35/2a2c6ad9685cd5e10000009b38f974/content.htm]" flag on. (eg. F-60 on V_T001B for "Posting Periods: Specify Time Intervals")
Regards,
Raymond -
Creating new Layout problem with merged table within std_resources.htm
Dear All,
i am relatively new to oracle ucm and i am trying to add new comonent to create new layout from oracle Create and Modify Layout Sample Component* example under http://www.oracle.com/technetwork/middleware/content-management/index-092832.html .
i want to ask about the following
in this component i have CreateLayout_Layouts Table, CreateLayout_PublishedWeblayoutFiles Table and CreateLayout_PublishedStaticFiles Table. These tables should be merged with LmLayouts table, PublishedWeblayoutFiles table and PublishedStaticFiles table respectively in the std_resources.htm file in the <install_dir>/shared/config/resources directory.
The problem is in my std_resources.htm file i have the following :
<tr>
<td>LmLayouts</td><td>LmLayouts</td><td>LmLayouts</td><td>id</td><td>label</td>
<td></td><td>7.3</td><td>1</td>
</tr>
how can i add (merge) the CreateLayout_Layouts Table in LmLayouts table? what is should fill the <td>s ?
for PublishedWeblayoutFiles table and PublishedStaticFiles table they are not exist in my std_resources.htm file. are there names changed? or shall i add them(if yes, what is the <td>s had inside).
note: i will be greatfull if someone have the std_resources.htm that have the above tables merged with the specified ones.I believe that sample is old. i have been pushing to get an updated version out also. Hopefully the fragmentary information I will give here will help.
The main changes are dynamic data tables which replace the includes to control the menu items and relationships. The old things should work still but good to use the new. At the end is an example of merge rules.
See 3.5.2 Dynamic Data Tables
http://docs.oracle.com/cd/E21764_01/doc.1111/e10807/c03_components.htm
==============================
CoreMenuItemRelationships table example
<?commatable mergeKey="primaryKey" derivedColumns="primaryKey:parentId+id"?>
parentId, id, loadOrder
MY_CONTENT, NEW_PAGE, 9000
================================
CoreMenuItems table example
<?commatable mergeKey="primaryKey" derivedColumns="primaryKey:parentId+id"?>
id, label, linkType, linkData
NEW_PAGE, wwNewPage, cgi, IdcService=GET_DOC_PAGE&Action=GetTemplatePage&Page=NEW_PAGE
============================
CoreMenuItemsFlags table example
<?commatable indexedColumns="id"?>
id, flags
WORK_IN_PROGRESS, isSubAdmin
=======================
CoreMenuItemsImages table example
<?commatable indexedColumns="id"?>
id, image, imageOpen
ACTIVE_WORKFLOWS, ReviewContent.gif,
Glue file example: (note I am not willing to upload a zip file of a full component sorry)
<?hda version="11gR1-dev" jcharset="UTF8" encoding="utf-8"?>
@Properties LocalData
ComponentName=NewLayout
blDateFormat=M/d/yyyy {h:mm[:ss] {aa}[zzz]}!mAM,PM!tAmerica/Chicago
hasPreferenceData=0
preventAdditionalComponentDowngrade=0
serverVersion=7.1
version=2011_11_13-dev
@end
@ResultSet ResourceDefinition
4
type
filename
tables
loadOrder
resource
resources/newlayout_resource.htm
null
10
template
templates/newlayout_template.hda
null
10
resource
resources/newlayout_strings.htm
null
10
@end
@ResultSet Filters
4
type
location
parameter
loadOrder
@end
@ResultSet MergeRules
4
fromTable
toTable
column
loadOrder
NewLayout_Layouts
LmLayouts
id
10
NewLayout_PublishedWeblayoutFiles
PublishedWeblayoutFiles
path
10
NewLayout_PublishedStaticFiles
PublishedStaticFiles
null
10
NewLayout_LayoutSkinPairs
LmLayoutSkinPairs
null
10
NewLayout_Templates
IntradocTemplates
name
10
@end
@ResultSet ClassAliases
3
classname
location
loadOrder
@end -
Problem with nested table in PropertySheet
Hi Guys ,
I have a table and bind it to my ObjectListDataProvider
Inside my table i have list of checkbox so user can tick which column they want to delete.
it works well .
But as soon i create a property sheet and put this table under PropertySheet.. the checkbox checking doesn't work anymore?
( i meant my listener to this checkbox doesn't work )
Anybody has any idea??
Thanks in advance.but it works okay with GridPanel..
Is it a bug? -
Error while create trigger on for nested table
I want to insert a record into a nested table.For this, I created a view for the table, which includes the nested table.It told me ORA-25015 cannot perform DML on this nested table view column.So I created a trigger for the nested table.However, it told me that ORA-25010 Invalid nested table column name in nested table clause.I think my nested table is valid, i don't konw why did it appear this kind of problem?
My table is
CREATE TABLE ENT
ID NUMBER(7) NOT NULL,
CREATE_DATE VARCHAR2(11 BYTE),
UPDATE_DATE VARCHAR2(11 BYTE),
DEPTS VARRAY_DEPT_SEQ
CREATE OR REPLACE
TYPE DEPT AS OBJECT
ID NUMBER(8),
ANCHOR VARCHAR2(20),
CREATE OR REPLACE
TYPE " VARRAY_DEPT_SEQ" as varray(930) of DEPT
CREATE OR REPLACE VIEW ENT_NESTED_VIEW
(ID, CREATE_DATE, UPDATE_DATE, DEPTS)
AS
select e.ID,cast(multiset(select r.id,r.anchor from ent z, table(z.depts) r where z.ID=e.ID )as varray_dept_seq)
FROM ENT e
Then when I created trigger;
CREATE OR REPLACE TRIGGER EMP.ENT_NESTED_TRI
INSTEAD OF INSERT
ON NESTED TABLE DEPTS OF EMP.ENT_NESTED_VIEW
REFERENCING NEW AS New OLD AS Old PARENT AS Parent
FOR EACH ROW
BEGIN
END ;
I met the problem: ORA-25010 Invalid nested table column name in nested table clause
Could you please tell me the reason
Thank you!
My insert SQL is:
insert into table(select depts from ent_nested_view where id=1856) values(varray_dept_seq(dept(255687,'AF58743')))
Message was edited by:
user589751Hi,TongucY
Compared with the "Referencing Clause with Nested Tables" part of this reference -
http://psoug.org/reference/instead_of_trigger.html, I found the answer of this
quesion. That is "CREATE OR REPLACE TYPE " VARRAY_DEPT_SEQ" as[b] varray(930) of
DEPT". It turns to be a varying array, not a nested table. It should be "CREATE OR
REPLACE TYPE " VARRAY_DEPT_SEQ" as table of DEPT". That is OK. Thank you very
much!
While there is an another question, if I create a varying array like" CREATE OR
REPLACE TYPE " VARRAY_DEPT_SEQ" as[b] varray(930) of DEPT " and I want to insert
a record into the varying array, which the record has been existed.The method that
create a view and a trigger seems not to be effective.
For instance,
There is a record in the table
ID:1020
CREATE_DATE:2005-10-20
UPDATE_DATE:2007-2-11
DETPS: ((10225,AMY))
I want to ask this record to be
ID:1020
CREATE_DATE:2005-10-20
UPDATE_DATE:2007-2-11
DETPS: ((10225,AMY),(10558,TOM))
How should I do?
Could you please help me?
Best regards.
Message was edited by:
user589751
Maybe you are looking for
-
One of our user has installed office 2007. Previously user was using 2003. While user want to download data for report ZMM60 he gets know data. While I am using 2003 I was able to download and see data in that. User get only blank excelsheet. Does a
-
How Do I Get the Customer Support ID?
Hello We currently use Oracle 11G. I would like to access some of my forums on My Oracle Support but I need the company's CSI. Where exactly can I get my company's customer support id? Is it within a DBA table? Thanks
-
See above. Firefox window will not default to full size when I open applicaiton, new window or new tab
-
Updating custom schema created using RCU
I followed the following chapter from RCU user guide to create a custom schema using RCU: [Extending Repository Creation Utility to Configure Custom Application Repositories|http://download.oracle.com/docs/cd/E14571_01/doc.1111/e14259/rcu_extend.htm]
-
Bluetooth: 8310 won't complete pairing with hands-free kit in 2006 X-type Jaguar
My new 8310, v4.2.2.181 (Platform 2.5.0.35), recognises the hands-free kit in our 2006 Jaguar X-type ("Jaguar" shows on the Bluetooth paired devices screen), but the pairing won't complete through to connection. Our dealer has confirmed that other p