Inserting data in the nested table
I explore the differences between the OBJECT and RECORD.
As I'm still learning, I found that both are structures which essentially brings together different elements of types of different data or columns of data types, one is used in SQL and other is used in PL/SQL, please correct me if I'm wrong in my understanding.
Below, I am trying to insert data into an array of type object, but I can't can you please help.
CREATE OR REPLACE type sam as OBJECT ( v1 NUMBER, v2 VARCHAR2(20 CHAR) ); ---Nested Table--- create or replace type t_sam as table of sam; --Inserting data---- insert into table(t_sam) values(sam(10,'Dsouza'));
Error message:
Error starting at line 22 in command: insert into table(t_sam) values(sam(10,'Dsouza')) Error at Command Line:22 Column:13 Error report: SQL Error: ORA-00903: invalid table name 00903. 00000 - "invalid table name" *Cause: *Action:
Ariean wrote:
So the only purpose of the equivalent concept of SQL types of nested tables is to use one of the data types when you define an actual table?
So-you can certainly use more that a simple "set an actual table. (I'm fairly certain that you can pass a table nested within a procedure, for example - try it, though - I'm not 100% sure on that - it just 'logic'.) If you can define a type, you can use it, pass it around, whatever.).
Ariean wrote:
And this nested table could be a record in SQL or object in PLSQL or simple data type (varchar number, etc.)?
Nested tables are just like any other type of custom data. You can create a nested table of other types of data. You can create a custom of nested tables data type.
Stupidly, he could become... uh, stupid O_0
CREATE TYPE o_myobj1 AS object ( id1 number, cdate1 date ); CREATE TYPE t_mytype1 AS table of o_myobj1; CREATE TYPE o_myobj2 AS object ( id2 number, dumb t_mytype1 ); CREATE TYPE t_dumber AS table of o_myobj2;
O_0
OK, my brain is starting to hurt - I hope you get the idea
Ariean wrote:
Second is my understanding correct any OBJECT & RECORD?
I see no benefit to describe another way.
Tags: Database
Similar Questions
-
Insert and update the nested table
Hello
I created a nested table containing the following columns. I need to insert records into the nested table. And also I have to update the nested table. Please find below my table and get error message.
Please advose...!
Can I use '&' while inserting records in the nested table? Yes / No?SQL> create type details as object( 2 basic number(7,2), 3 da number(6,2), 4 hra number(6,2), 5 pf number(6,2), 6 it number(6,2), 7 gross number(7,2), 8 ded number(6,2), 9 net number(8,2)); 10 / Type created. SQL> create type details_t is table of details; 2 / Type created. SQL> ed Wrote file afiedt.buf 1 create table emp_tab(empno number(4),name varchar2(10),details_tab details_t) 2* nested table details_tab store as empl_details SQL> / Table created. SQL> ed Wrote file afiedt.buf 1* insert into emp_tab values(&empno,'&name',details_t(details(&da,&hra,&pf,&it,null,null,null))) SQL> / Enter value for empno: 1 Enter value for name: asdf Enter value for da: 120 Enter value for hra: 130 Enter value for pf: 120 Enter value for it: 120 old 1: insert into emp_tab values(&empno,'&name',details_t(details(&da,&hra,&pf,&it,null,null,null new 1: insert into emp_tab values(1,'asdf',details_t(details(120,130,120,120,null,null,null))) insert into emp_tab values(1,'asdf',details_t(details(120,130,120,120,null,null,null))) * ERROR at line 1: ORA-02315: incorrect number of arguments for default constructor
I do need to update also net gross, ded, columns... !!
Please help me... !!
Concerning
A$ sqlplus scott/tiger SQL*Plus: Release 10.2.0.2.0 - Production on Thu Apr 21 16:18:16 2011 Copyright (c) 1982, 2005, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production With the Partitioning, OLAP and Data Mining options SQL> CREATE TYPE details AS OBJECT( basic NUMBER(7,2), da NUMBER(6,2), hra NUMBER(6,2), pf NUMBER(6,2), it NUMBER(6,2), gross NUMBER(7,2), ded NUMBER(6,2), net NUMBER(8,2)); 2 3 4 5 6 7 8 9 10 / Type created. SQL> CREATE TYPE details_t IS TABLE OF details; 2 / Type created. SQL> CREATE TABLE emp_tab(empno NUMBER(4),name VARCHAR2(10),details_tab details_t) NESTED TABLE details_tab store as empl_details 2 3 / Table created. SQL> INSERT INTO emp_tab VALUES(7001,'Saubhik',details_t(details(100,100,50,10,10,null,null,null))); 1 row created. SQL> SELECT * FROM TABLE (SELECT details_tab FROM emp_tab WHERE empno=7001); BASIC DA HRA PF IT GROSS DED ---------- ---------- ---------- ---------- ---------- ---------- ---------- NET ---------- 100 100 50 10 10 SQL> ^C SQL> ed Wrote file afiedt.buf 1 UPDATE TABLE (SELECT details_tab FROM emp_tab WHERE empno=7001) 2 emp_sal 3* SET emp_sal.net=emp_sal.basic+emp_sal.da+emp_sal.hra SQL> / 1 row updated. SQL> SELECT * FRM emp_tab; SELECT * FRM emp_tab * ERROR at line 1: ORA-00923: FROM keyword not found where expected SQL> SELECT * FROM emp_tab; EMPNO NAME ---------- ---------- DETAILS_TAB(BASIC, DA, HRA, PF, IT, GROSS, DED, NET) -------------------------------------------------------------------------------- 7001 Saubhik DETAILS_T(DETAILS(100, 100, 50, 10, 10, NULL, NULL, 250)) SQL>
-
cannot insert data into the PRODUCT_USER_PROFILE table
I've connected to the database as the sysdba, which is installed on VMWARE. database is oracle 11g.
whenever I insert data in the table PRODUCT_USER_PROFILE that the database returns 1 row inserted and then when I try to show everything on the table before or after the statement commit is made the database returns "No. LINES SELECTED.
guys any idea about this problem...Hello
Try to connect as a system and make the insert and check. Always think about the issue.
-Pavan Kumar N
Oracle 9i / 10g - OCP
http://oracleinternals.blogspot.com/Published by: pounet on January 4, 2010 16:29
-
Insert data into the same table based on certain conditions
Hello. I'm new to this forum.
I have to write a stored procedure to insert data in a table MYTABLE say, having a structure like:
Col1 Col2 Col3... TotalInstallments CurrentInstallment PaidAmount MonthYear
I have to insert all the data that it is in the same table (MYTABLE) except change some fields based on certain conditions:
1. if PaidAmount > 0 & & CurrentInstallment < TotalInstallment then
CurrentInstallment = CurrentInstallment + 1
2. in the field MonthYear I have data ex. 01/2012, 11/2012 formate(month/year)...
So, I have to insert data by incrementing the month and year. for example:
If currentdata is 11/2012 next data will be 12/2012
But following will be 01, 2013
I have to select all records that belongs to the previous month (across the field MonthYear) and put the audit on each record selected and insert data and then turns them into table (MYTABLE) even.
How to achieve that?
Thank you.978184 wrote:
Hello. I'm new to this forum.
I have to write a stored procedure to insert data in a table MYTABLE say, having a structure like:Col1 Col2 Col3... TotalInstallments CurrentInstallment PaidAmount MonthYear
I have to insert all the data that it is in the same table (MYTABLE) except change some fields based on certain conditions:1. if PaidAmount > 0 & CurrentInstallment
CurrentInstallment = CurrentInstallment + 1
2. in the field MonthYear I have data ex. 01/2012, 11/2012 formate(month/year)...
So, I have to insert data by incrementing the month and year. for example:
If currentdata is 11/2012 next data will be 12/2012
But following will be 01, 2013
I have to select all records that belongs to the previous month (across the field MonthYear) and put the audit & on each of the selected data record and insert then turns them into table (MYTABLE).You can do this way:
This is not tested, but if you can provide the example of table structure and data (IN create table and insert scripts), it can be put to the test.
insert into your_table (col1, col2, col3...current_installment, month_field) select col1, col2, col3.., current_installment + case when paidamount > 0 and current_installment < total_installment then row_number() over ( partition by column1, column2,.. columnn -->You may choose partition if you want the --Increment of Current_installment to reset after particular combination ends order by primary_key -->Order the Increment, you may choose to add more columns to order by ) else 0 --> if condition is not met, then Add 0 end curr_installment, add_months(to_date(month_field, 'MM/YYYY'), 1) nxt_month from your_table;
-
Inserting data in the PLSQL table
Hello
I'm trying to create a table of records and try to insert some data into it. But it is throwing error when compiling. Can someone help me solve the problem. My procedure is:
create or replace
procedure 'IL_BAL_CAL_PROC' is
type il_bal_cal_acc_tab_rec is record (GID_NO VARCHAR2 (4), REG_CODE VARCHAR2 (2), VAC VARCHAR2 (10), BRANCH_CODE VARCHAR2 (4), CTL VARCHAR2 (4), OPEN_DT DATE, RECORD_STAT VARCHAR2 (1), CLOSE_DT DATE);
type il_bal_cal_acc_tab_type is table of the il_bal_cal_acc_tab_rec;
il_bal_cal_acc_tab il_bal_cal_acc_tab_type:=il_bal_cal_acc_tab_type();
BEGIN
-first approach
insert into il_bal_cal_acc_tab values('12');
--deuxieme approach
/ * Insert in il_bal_cal_acc_tab
Select p_gidno,
p_region,
a.ACC,
a.brncd,
a.CCY,
a.accopendt,
a.record_stat,
NULL as closdt
stvws_cust_account_if a.,
b stvws_branch_dates,
sttms_account_class c,
sttms_dda_maininfo d
where a.acc = d.customer_account
and a.brncd = b.branch_code
and b.branch_code = d.branch_code
and a.account_class = c.account_class
and a.accopendt < trunc (to_date(b.today,'dd-mon-yy'), 'mm')
and a.record_stat = 'O'
and I'm c.dda_account_type <>'
and a.auth_stat = 'A'
and d.region_code = p_region
Union
Select p_gidno,
p_region,
a.ACC,
a.brncd,
a.CCY,
a.accopendt,
a.record_stat,
c.closdt
stvws_cust_account_if a.,
b stvws_branch_dates,
stvws_cust_ac_closure_if c,
sttms_dda_maininfo d
where a.acc = c.ac_no
and c.ac_no = d.customer_account
and a.brncd = b.branch_code
and b.branch_code = c.branch_code
and c.branch_code = d.branch_code
and a.record_stat =' it
and c.closdt > = trunc (b.today, 'mm')
and d.region_code = p_region;
commit; * /
END;
Please tell me how to insert data into tables of this kind?I generally do like this
CREATE OR REPLACE PROCEDURE "IL_BAL_CAL_PROC" IS CURSOR cur_il_bal_cal_acc_tab_type IS SELECT p_gidno, p_region, a.acc, a.brncd, a.ccy, a.accopendt, a.record_stat, NULL AS closdt FROM stvws_cust_account_if a, stvws_branch_dates b, sttms_account_class c, sttms_dda_maininfo d WHERE a.acc = d.customer_account AND a.brncd = b.branch_code AND b.branch_code = d.branch_code AND a.account_class = c.account_class AND a.accopendt < TRUNC (TO_DATE (b.today, 'dd-mon-yy'), 'mm') AND a.record_stat = 'O' AND c.dda_account_type <> 'M' AND a.auth_stat = 'A' AND d.region_code = p_region UNION SELECT p_gidno, p_region, a.acc, a.brncd, a.ccy, a.accopendt, a.record_stat, c.closdt FROM stvws_cust_account_if a, stvws_branch_dates b, stvws_cust_ac_closure_if c, sttms_dda_maininfo d WHERE a.acc = c.ac_no AND c.ac_no = d.customer_account AND a.brncd = b.branch_code AND b.branch_code = c.branch_code AND c.branch_code = d.branch_code AND a.record_stat = 'C' AND c.closdt >= TRUNC (b.today, 'mm') AND d.region_code = p_region; TYPE il_bal_cal_acc_tab_type IS TABLE OF cur_il_bal_cal_acc_tab_type%ROWTYPE INDEX BY BINARY_INTEGER; il_bal_cal_acc_tab il_bal_cal_acc_tab_type; BEGIN OPEN cur_il_bal_cal_acc_tab_type; FETCH cur_il_bal_cal_acc_tab_type BULK COLLECT INTO il_bal_cal_acc_tab; CLOSE cur_il_bal_cal_acc_tab_type; END;
-
Inserting data in the remote table takes too long
Hello
I have a table in the remote database and insert the data into this particular table... takes too long.
Could you please advice me some tips for the DML can quickly...
Concerning
DASThat takes a lot of time, then don't you have an idea how can we send the data fast
Buy more band witdth?
No, honestly. As you can see, the quality of my answers match the quality of your question.
You must locate the bottleneck, where is - this "too much" time has passed.
Is it
collection of data on the local side?
net send?
Actual insertion on remote site?
Maybe you have a condition on the remote site, which causes the data sent to the remote side to local?Impossible to give advice without knowing anything about what is happening.
Concerning
Peter -
How can I do a new insert data in the other table extrancting?
Hello, I'm looking how to do an insertion of two tables save values and apply to other tables like this:
The insert I'm looking for is something like this:
Have two tables, the first table is emp1 and contains the column: data 1 and 2 with line of data1: 1234 and line data 2:5555, therefore,.
I want to create an insert on a new table called (emp2) that contain the data in the column: data 1, data 2 (from the first table demo1), data 3, data 4, etc.
How insert again I can put / call data from another table insert in this table (emp2).
I don't know if my example is correct (my English is very bad).
This is an example: (sorry for the points).
table EMP2:
1 data... 2 data... 3 data... data 4... data 5
(from emp1)... (from emp1)... 8534... 2347... 4544
Thanks for the help.
Published by: user10182692 on 24-May-2009 08:39
Published by: user10182692 on 24-May-2009 08:40
Published by: user10182692 on 24-May-2009 08:45Welcome! on the forum.
You can include the code and data in the {code} tags
If I'm good, and I know what is your condition
insert into emp2 ( data1, data2) select data1, data2 from emp1
SS
-
Inserting data in several related tables using the database
Hello world
I'm working on a BPM application using Oracle BPM 11.1.1.5.0 and JDeveloper 11.1.1.5.0.
In my database, I have two tables, loan and guarantee that are related by a field named employeeID (PK on loan) and FK in warranty.
Each line can have several lines of guarantee.
At this point, I'm doing an entry form for the user to insert data in the two tables.
I did successfully before with a single table that has no relations.
The way I'm doing here is, after the creation of the database successfully adapter, a type of LoanCollection is created in the types module, which can be used to create business objects and data objects of.
The problem is when I create an object of type loanCollection process data and then create a UI generated automatically on that basis, only the fields in the primary table (the Table of loan) appear in the form.
On the other hand, if I create a business object based on the LoanSchema, the form for all of the two tables is created automatically (the loan as a form, the guarantee in a table), but then, when I try to access it in the section processing service mission which calls the database adapter, I have no access to such.
In fact, the only type which can be used in the service task is the process based on the loanCollection data object.
To summorize, I have to use the type of business for my UI object to include all the fields in both tables, so I have to use the data object from the collection process in the transformation of service task dialog box.
And I can't find a way to map to another.
Can someone help me with this please?
Thank you very muchTry to follow these steps.
1. create a new module in your catalogue our BPM project management section
2. in this new module create 3 Business Objects - (LoanBusinessObject, GuaranteeBusinessObject and GuaranteeArrayBusinessObject)
3. Add the attributes appropriate to the LoanBusinessObject and the GuaranteeBusinessObject so that they mimic your database tables, then to the GuaranteeArrayBusinessObject add an array of type attribute GuraranteeBusinessObject
4. now you need to create two process data objects, type loanProcessObject LoanBusinessObject and type guaranteesProcessObject GuaranteeArrayBusinessObject
5. as inputs to your human task adds the loanProcessObject and guaranteesProcessObject, these should now be available in your data controls and can be used to auto generate the form
6. in your dbadapter you'll then use XSL Transformation and use for each so that it will write the data to the ready table and all the line items of warranty for the warranty table. -
How to assign values to the nested table and passes as a parameter for the procedure?
How to assign values to the nested table and passes as a parameter for the procedure?
Here are the object and its type
create or replace type test_object1 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type1 is table of the test_object1;
create or replace type test_object2 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type2 is table of the test_object2;
GRANT ALL ON test_object1 to PUBLIC;
GRANT ALL ON test_type1 to PUBLIC;
GRANT ALL ON test_object2 to PUBLIC;
GRANT ALL ON test_type2 to PUBLIC;
Here is the table object type:
create the table test_object_tpe
(
sl_num NUMBER,
Description VARCHAR2 (100),
main_val1 test_type1,
main_val2 test_type2
)
NESTED TABLE main_val1 STORE AS tot1
NESTED TABLE main_val2 STORE AS earlier2;
-----------------------------------------------------------------------------------------------------------
Here is the procedure that inserts values into the nested table:
PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
Description in VARCHAR2,
p_main_val1 IN test_type1,
p_main_val2 IN test_type2
)
IS
BEGIN
FOR rec in p_main_val1.first... p_main_val1. Last
LOOP
INSERT INTO xxdl.test_object_tpe
(
sl_num,
Description,
main_val1,
main_val2
)
VALUES
(
sl_num
description
test_type1 (test_object1)
p_main_val1 .val1 (CRE),
p_main_val1 .val2 (CRE),
p_main_val1 .val3 (rec)
)
)
test_type2 (test_object2 (p_main_val2 .val1 (CRE),
p_main_val2 .val2 (CRE),
p_main_val2 .val3 (rec)
)
)
);
END LOOP;
commit;
END INSERT_TEST_DATA;
-------------------------------------------------------------------------------------------
Here are the block anonymoys what values attributed to the object type and pass values in the procedure:
Set serveroutput on;
declare
p_sl_num NUMBER: = 1001;
p_description VARCHAR2 (50): = 'Test Val1;
inval1 test_type1: = test_type1();
inval2 test_type2: = test_type2();
Start
inval1 (1) .val1: = "testx1";
inval1 (1) .val2: = "testx2";
inval1 (1) .val3: = "testx3";
inval2 (1) .val1: = "testy1";
inval2 (1) .val2: = "testy2";
inval2 (1) .val3: = "testy3";
CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
Description = > p_description,
p_main_val1 = > inval1,
p_main_val2 = > inval2
);
end;
/
Someone can correct me.
Thank you
LavanThanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
>
How to assign values to the nested table and passes as a parameter for the procedure?
>
Well you do almost everything bad that could be hurt.Here is the code that works to insert data into your table (the procedure is not even necessary).
declare p_sl_num NUMBER := 1001; p_description VARCHAR2(50) := 'Testing Val1'; inval1 test_type1 := test_type1(); inval2 test_type2 := test_type2(); begin inval1.extend(); inval1(1) := test_object1('testx1', 'testx2', 'testx3'); inval2.extend(); inval2(1) := test_object2('testy1', 'testy2', 'testy3'); INSERT INTO test_object_tpe ( sl_num, description, main_val1, main_val2 ) VALUES (p_sl_num, p_description, inval1, inval2); commit; end; /
See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)
inval1(1).val1 := 'testx1';
Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element
inval1.extend();
And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
If you can not doinval1(1).val1 := 'testx1';
You must create an instance of 'test_object1 '.
inval1(1) := test_object1('testx1', 'testx2', 'testx3');
And so on for the other collection
You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.
-
Hi all
I have a task to insert data in a nested table. First, I'll explain the scenario.
I have 2 table (of patients) and (tumors) that contain medical data on patients with cancer.
The table (of patients) contain the basic information about patients. The table (tumors) contain information about the tumors. each record in the table (the patients) may have one or more records in the table (tumors) using the column (patient_id). I want to transfer data from (of patients) and (tumors) tables to a new table (cancer_patients) that contains a nested table column. so I did the following codeCREATE TABLE "DSS2_MINING"."PATIENTS" ( "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE, "REGISTRY_ID" NUMBER(10,0), "RACE" VARCHAR2(2 BYTE), "SEX" VARCHAR2(1 BYTE), "BIRTHDATE_YEAR" NUMBER(4,0), "NUMBER_OF_PRIMARIES" NUMBER(1,0), "VITAL_STATUS_RECORD" VARCHAR2(1 BYTE), "CAUSE_OF_DEATH" VARCHAR2(5 BYTE), "SURVIVAL_TIME" VARCHAR2(4 BYTE), "SURVIVAL_TIME_FINAL" NUMBER, "SURVIVAL_VARIABLE" VARCHAR2(1 BYTE), CONSTRAINT "PATIENTS_PK" PRIMARY KEY ("PATIENT_ID"); CREATE TABLE "DSS2_MINING"."TUMORS" ( "TUMOR_ID" NUMBER NOT NULL ENABLE, "PATIENT_ID" VARCHAR2(10 BYTE), -- FK "SEER_RECORD_NUMBER" NUMBER, -- This column contain a sequance number of the records for each patients "MARITAL_STATUS" VARCHAR2(1 BYTE), "AGE" NUMBER, "DATE_OF_DIAGNOSIS" DATE, "HISTOLOGY_GROUP" VARCHAR2(2 BYTE), "BEHAVIOR" VARCHAR2(1 BYTE), "GRADE" VARCHAR2(1 BYTE), "DERIVED_AJCC_STAGE_GROUP" VARCHAR2(2 BYTE), "STAGE_OF_CANCER" VARCHAR2(2 BYTE), "RADIATION" VARCHAR2(1 BYTE), "CS_SCHEMA" VARCHAR2(2 BYTE), "FIRST_PRIMARY_IND" VARCHAR2(1 BYTE), "TUMOR_SIZE" NUMBER(4,1), "TUMOR_EXTENSION" VARCHAR2(2 BYTE), "LYMPH_NODES" VARCHAR2(1 BYTE), "NODES_POSITIVE" NUMBER, "ESTROGEN" VARCHAR2(3 BYTE), "PROGESTERONE" VARCHAR2(3 BYTE), "SURGERY" VARCHAR2(2 BYTE), CONSTRAINT "TUMORS_PK" PRIMARY KEY ("TUMOR_ID");
So my problem on the transfer and inserts data, I tried to use the associative array to keep the rows in the table of tumors, but it didn't work. I think that the main problem is that each record in the patient table have multiple records in the table of tumors.create or replace type tumor_object AS object( tumor_id VARCHAR2(1), marital_status VARCHAR2(1), age NUMBER(3), date_of_diagnosis DATE, cs_schema VARCHAR2(2), histology_group VARCHAR2(2), behavior VARCHAR2(1), grade VARCHAR2(1), first_primary_ind VARCHAR2(1), tumor_size NUMBER(4, 1), tumor_extension VARCHAR2(2), lymph_nodes VARCHAR2(1), nodes_positive NUMBER(4), surgery VARCHAR2(2), radiation VARCHAR2(1) ); create or replace type tumor_table as table of tumor_object; CREATE TABLE "DSS2_MINING"."CANCER_PATIENTS" ( "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE, "RACE" VARCHAR2(2 BYTE), "SEX" VARCHAR2(1 BYTE), "NUMBER_OF_PRIMARIES" NUMBER(1,0), "TUMORS" "DSS2_MINING"."TUMOR_TABLE" , "VITAL_STATUS_RECORD" VARCHAR2(1 BYTE), "CAUSE_OF_DEATH" VARCHAR2(5 BYTE), "SURVIVAL_TIME_FINAL" NUMBER, "SURVIVAL_VARIABLE" VARCHAR2(1 BYTE), CONSTRAINT "CANCER_PATIENTS_PK" PRIMARY KEY ("PATIENT_ID") NESTED TABLE "TUMORS" STORE AS "TUMORS_STOR_TABLE"
I hope that if anyone can help in this case or I you know any reference on similar cases
Thank you
A.L
Published by: user9003901 on November 26, 2010 02:48Something like:
INSERT INTO CANCER_PATIENTS SELECT PATIENT_ID, RACE, SEX, NUMBER_OF_PRIMARIES, ( SELECT CAST( COLLECT( TUMOR_OBJECT( TUMOR_ID, MARITAL_STATUS, AGE, DATE_OF_DIAGNOSIS, CS_SCHEMA, HISTOLOGY_GROUP, BEHAVIOR, GRADE, FIRST_PRIMARY_IND, TUMOR_SIZE, TUMOR_EXTENSION, LYMPH_NODES, NODES_POSITIVE, SURGERY , RADIATION ) ) AS TUMOR_TABLE ) FROM "TUMORS" T WHERE T.PATIENT_ID = P.PATIENT_ID ), VITAL_STATUS_RECORD, CAUSE_OF_DEATH, SURVIVAL_TIME_FINAL, SURVIVAL_VARIABLE FROM PATIENTS P /
SY.
P.S. This site has censorship. It replaces the word S E X with *, change it if during the test. -
Insert data into the source of destinator Table
Hi all
Need to insert data in sample_table1 table xxc_source_table sample_table2
create table xxc_source_table (DESCRIPTION varchar2 (10));
Insert the table xxc_source_table values('A201.) ABC.4084.GR');
create table sample_table1 (col_1 varchar2 (10), col_2 varchar2 (10), col_3 varchar2 (10), col_4 varchar2 (10));
create table sample_table2 (col_1 varchar2 (10), col_2 varchar2 (10), col_3 varchar2 (10), col_4 varchar2 (10), moved_flag varchar2 (2));
col_1 = A201
col_2 = ABC
col_3 = 4084
col_4 = GR
Note: Insert data into the col_1, the col_3, the col_4 of the xxc_source_table sample_table1
(2) if the next (form xxc_source_table) data is exist in the sample_table2, and then set the moved_flag as Y in this column
3) xxc_source_table has 17000 lines
Thank you.
Post edited by: Rajesh123 please do not consider cross the line message
Hi Renon,
Why you don't want substr and instr? For best performance, you should go with substr and instr instead of regexp_substr. However you asked me to provide the code instead of substr and InStr. Then try the below...
INSERT ALL
IN VALUES sample_table1 (col1, col2, col3, col4)
IN sample_table2 VALUES (col1, col2, col3, col4, 'Y')
SELECT REGEXP_SUBSTR (DESCRIPTION,'[^.] +', 1, 1) col1,.
REGEXP_SUBSTR (DESCRIPTION,'[^.] +', 1, 2) col2.
REGEXP_SUBSTR (DESCRIPTION,'[^.] +' 1, 3) col3.
REGEXP_SUBSTR (DESCRIPTION,'[^.] +' 1, 4) col4
OF xxc_source_table;
Thank you
Ann
-
What is the preferred means of data transmission in the associative array of the nested table record vs
Choose between Nested Tables and associative arrays
The two nested tables and associative arrays (formerly index - by tables) use similar index notation, but they have different characteristics when it comes to persistence and ease of passing parameters.
Nested tables can be stored in a column of data, but can of associative arrays. Nested tables can simplify the SQL operations where you would normally join a single-column table with a larger table.
Associative arrays are appropriate for relatively small lookup tables where the collection can be constructed in memory whenever a procedure is called or a package is initialized. They are good for the collection of the information volume is unknown beforehand, because there is no fixed limit on their size. Their index values are more flexible, as associative array indices can be negative, can be no sequential and can use values of string instead of numbers.
PL/SQL automatically converts between the bays of the host and the associative arrays that use values of digital keys. The most effective way to move the collections to and from the database server is to implement data values in associative arrays, and then use these associative arrays with erections in bulk (the
FORALL
statement orBULK
COLLECT
clause).With the help of documents and Collections of PL/SQL
Read this:
-
Button insert data to the table
Hello
I use APEX 4.2.3 with XE, I try to insert data into the table using code below but nothing happen when I press the button, create this button like 'create a button to point to page'-> 'dynamic action'-> 'run pl/sql '.
begin insert into dummy values('xx'); commit; end;
So to clarify, you have
(1) created a button that "action" is "defined by the dynamic action.
(2) created a dynamic action that executes pl/sql at the click on the button and you are pl/sql?
-
How to insert the legacy data into the QP_RLTD_MODIFIERS table?
How insert Legacy data into the QP_RLTD_MODIFIERS table in the instance of R12.
I would use the QP_Modifiers_PUB API. Process_Modifiers to push the old data on prices in R12. QP_RLTD_MODIFIERS is only used for certain types of discounts (in my prod environment, only the promos are given in this table).
-
What trigger to use to insert data into the table db forms
Hello
My form is current having a block of database with the table reference. When you enter data into the form field and click Save. Automatically record is inserted in the database table.
I want to do this under manual insert. I changed the block of data to a data non-base. Where should I write the insert statement to insert data into the table.
Is - shutter release key of the form-level validation?
Please notify.
Thank you
Didi.You can guide me how to remove the message FRM-40401 no changes to save and instead, I wanted to put 1 transaction record successful... some like it like that.
Hi didi.
And this is my last post I'll sleep. ;)
Take form level trigger named preform
and write on it:SYSTEM.MESSAGE_LEVEL := 5;
I hope this works...
Hamid
Mark correct/good to help others to get the right answers. *
Maybe you are looking for
-
MacBook pro mid-2010 shows prohibited signs
Hello Apple community, I need your help in reality two days ago my macbook pro mid 2010 running os x el capitan died suddenly following an unknown error, when I turned it on I noticed a forbidden error kept showing once more are trying. I did reset P
-
Downloaded Update 6 times or more. Everything goes down as usual until you restart. I opened FF5 and a window that tries to connect to the server to update forever. (actually, I let go a few hours before closing) Every day he wants to update me 6.0,
-
Are my PCIe x 1 slots PCIe 1.0 or 2.0?
HP Pavilion p6180t CTO desktop PC Card mother IPIEL-A3 (Eureka3)
-
It happens to someone else? When you zoom in to take a video the reds jumping around?
-
HP Officejet 8625: Interference of your Fax with phone
I have a desktop with Mac laptop, desktop and HP Officejet 8625 phone. I have my Officejet connected to my 1 d phone jack, and when I get a phone call I have a fax on the line tone. How do I remove it?