SQL & PL/SQL :: Dynamic Way To Insert Data Into Correct Column In Table?

Dec 26, 2011

i used sql loader to import data from csv file to my db.but every time the columns places are changed.o i need dynamic way to insert data into correct column in the table.

in csv file contains column name and i insert this data to temp table, after that i want to read data over column name.also i read the column names from (All_Tab_Columns) to make combination of column name between temp table and All_Tab_Columns table to insert data to right place...

View 39 Replies


ADVERTISEMENT

SQL & PL/SQL :: Dynamic Query In View For Correct Column Name

Feb 20, 2012

I don't know what column name would there for my new view. so can i use dynamic SQL in View so that I can get correct column name?

View 2 Replies View Related

PL/SQL :: Insert Dynamic Table

Nov 9, 2012

Oracle 11.2

I trying to create a procedure that could update one or more different table into clob data - but only those tables that contain your search (indexed) word.

I have a 3 tables: item, common_lookup, member

>
CREATE INDEX i_item_barcode ON item (item_barcode) INDEXTYPE IS ctxsys.context;
CREATE INDEX i_item_title ON item (item_title) INDEXTYPE IS ctxsys.context;
CREATE INDEX i_item_subtitle ON item (item_subtitle) INDEXTYPE IS ctxsys.context;
CREATE INDEX i_common_lookup_meaning ON common_lookup (common_lookup_meaning) INDEXTYPE IS ctxsys.context;
CREATE INDEX i_account_number ON member (account_number) INDEXTYPE IS ctxsys.context;

[Code]....

Now is the question.. If it possible to create the procedure search_execute which can add data depending on subbmited parameters ?
If it possible, can You give me an example (dbms_output/update_clob), for search_execute to recive something like that:

>
search_execute ('Wars', item, item_title)
>
>

select * from clob data :
1      1068     ASIN: B00003CX5P     1014     Star Wars - Episode I      The Phantom Menace      (CLOB)     (BLOB)          PG      MPAA     22-mar-2005     3     16-lut-2012 17:31:55     3     16-lut-2012 17:31:55     
2      1069     ASIN: B00006HBUJ     1014     Star Wars - Episode II      Attack of the Clones      (CLOB)     (BLOB)          PG      MPAA     22-mar-2005     3     16-lut-

[Code]....

I try write something like this (it is not compile - and I know where is mistake, I tried to figure it out in several different ways - This is just my way of thinking expression) :
>
CREATE OR REPLACE PROCEDURE search_execute (v_text IN VARCHAR2, v_column_name IN VARCHAR2, v_table_name IN VARCHAR2)
IS
v_clob CLOB;
v_tmp_clob CLOB;
CURSOR c1 IS (SELECT * FROM v_table_name WHERE contains (v_column_name, v_text) > 0);
CURSOR c2 IS (SELECT column_name FROM user_tab_cols WHERE table_name = v_table_name);
BEGIN

[Code]...

View 0 Replies View Related

Insert Using Append / Bulk Correct?

Aug 3, 2011

I want to know which is the most efficient insert method among the followiing

1)using the hint append
or
2)bulk collect. Preferably I'd like to know which method of inserting for say 2-5 millions rows is the best.

View 6 Replies View Related

Forms :: Dynamic List From One Table And Insert Into Another?

Jan 10, 2013

Im facing some issues with my form, getting stuck... prob desc below : I have Table A which has columns; car_year, car_type, line_num, line_text. Table B has country, car_year, car_type, line_num, data_entry_amt.

Table A contains data which gets updated once every year only. Contains what year model is the car, what type of car it is.. Line_num has numbers starting from 1 which indicates the different part number and line_text has description for that line_num. eg :
2010 Toyota 1 Windshield
2010 Toyota 2 Door
2010 Toyota 3 Tire
2010 BMW 1 Windshield
2010 BMW 2 Door
2010 BMW 3 Tire
2010 BMW 4 Rear_mirror

Table B contains specific data related to table A, Contains country where car details n prices are, car_year, car_type, line_num, and amount($) for that part. for example :
Australia 2010 Toyota 1 400.50
Australia 2010 Toyota 2 200.40
Australia 2010 Toyota 3 308.25

So in year 2010, in Australia, Toyota's Door was sold at $200.40 Now, Table A will have similar data for this year and users will enter data for table B throughout this year. I tried master-detail form for this but it doesnt work. Because every year line_num change in table A and therefore cant implement a fixed number or rows on the form for amount for table B.

How to use dynamic listing but im not familiar with it. So how i should go about doing this. My form has structure has below :

Country Car_year
___________________________________________________
table_A.line_num table_A.line_text table_B.data_entry_amt
table_A.line_num table_A.line_text table_B.data_entry_amt
table_A.line_num table_A.line_text table_B.data_entry_amt
table_A.line_num table_A.line_text table_B.data_entry_amt

When clicked on save, data on table_B.data_entry_amt on this form should go n insert into table B.

View 1 Replies View Related

JDeveloper, Java & XML :: Design Dynamic Table And Insert In A View

Feb 25, 2011

I'm in a situation where i have to design dynamical XML table that gonna get inserted in a view:

late'si consider the following table:

CREATE TABLE FB_XML
(
ID NUMBER(10) NOT NULL,
FB_ID NUMBER(10),
XMLCONTENT CLOB
)

the XML content field have content like the following:

XMLROOT(XMLELEMENT (
"Form",
XMLELEMENT ("elements",
(SELECT XMLAGG (
[code].......

so late consider for the first row i insert for the

* id:1
* fb_id : 25
* xmlcontent:
XMLROOT(XMLELEMENT (
"Form",
[code]........

the code works "fine" here but the xml in the fb_xml table is not EXECUTED it simply escaped by oracle , i know i should add something so that the XML have to execute and generate.

View 3 Replies View Related

SQL & PL/SQL :: Insert Data In Clob Column?

Jun 13, 2012

i have a problem when i try to insert a large character string of nearly 1 lac characters (code of html) in a clob column of my test table, then i get an error "ORA-01704: string literal too long" , i didnot understand that why clob column is not storing this data.

View 1 Replies View Related

SQL & PL/SQL :: Data Of Column Is Large - How To Insert

Oct 9, 2013

I have encountered some problems in SQL I want to create a table with a bunch of prepared data. For ease of use, I choose to generate a SQL file which contains all the sql clauses used to create the table and insert the data. So all the data can only be inserted to a table using sql clause.

My questions:
1) If data of a column is large (for example, 1 M text), how to insert it using SQL, is there a piecewise method.
2) And how can I insert BLOB data using SQL clause.

What I what is to enclose all the operations in a single SQL file, and when the table is needed, just execute this SQL file.

View 2 Replies View Related

XML DB :: Insert Element Into Data Stored In CLOB Column?

Dec 14, 2012

My ORACLE DB version is:

('Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production');
('PL/SQL Release 11.2.0.2.0 - Production');
('CORE 11.2.0.2.0 Production');
('TNS for Linux: Version 11.2.0.2.0 - Production');
('NLSRTL Version 11.2.0.2.0 - Production');

I have this XML data stored in a CLOB column:

<Activity>
<Changes>     
</Changes>
<Inserts>     
</Inserts>
<Definition>     

[code]....

I need creating an update that will insert another <Activity>SomeGUID</Activity> into the <Spawned> parent.

View 3 Replies View Related

PL/SQL :: Checking Correct Data Format Using Sql Query?

Aug 30, 2013

1) I got column date of joining which accepts date in below format DD-MON-YYYYDD-MON-YYMON-DD-YYYYMON-DD-YYMonth DD,YYYY Question:-

how do i check whether all dates in Date of joining column are in above format or not using sql query? 2) I got one more date column which accepts date in below formatMMDDYYYYYYYYMMDDMM/DD/YYYYMM/DD/YYYYYY/DD/MM Question:-

how do i check whether all dates in date column are in above format or not using sql query?

View 26 Replies View Related

Insert Formatted Template In A Table Column

Jan 17, 2011

I want to insert a formatted template into a table column. Is there any function for this requirement.

want is this format

Best Regards,
XYZ

View 1 Replies View Related

PL/SQL :: How To Insert Sequence Numbers In A Table Column

Aug 23, 2012

I am having the emp table :

empno enmae job
1111 ramu S.E
7658 VENU S.S.E
8280 GETA TRAINEE

alter table emp add sno number

for that sno i have to generate 1,2,3,...

View 4 Replies View Related

SQL & PL/SQL :: Selecting Correct Record From The Table

Sep 26, 2013

I have a table with following structure:

CREATE TABLE ID_comments
(
ID CHAR(10 BYTE) NOT NULL,
S_COMMENTS VARCHAR2(255 BYTE),
P_COMMENTS VARCHAR2(255 BYTE),
C_COMMENTS VARCHAR2(255 BYTE)
);

For each Id, I can have multiple records.

Below is the insert script of one of the ID:

Insert into ID_comments values ('0813654254','','JR/0813653606 single','');
Insert into ID_comments values ('0813654254','','JR/0813653606 single','');
Insert into ID_comments values ('0813654254','','JR/0813653606 SINGLE','');
Insert into ID_comments values ('0813654254','','JR','');
[code].......

Now I want to select only one record from this table for an ID, which will have "not null" values for s_comments,p_comments,c_comments columns. If for some ID , there is no "not null" row for any column, then pick up the "null" row/value for that column.

View 14 Replies View Related

PL/SQL :: How To Insert Null Record (some Column) In Table Using Loop

Jul 5, 2012

How to insert null record (for some columns) in table using loop.

sample data of x_tab

order_id order_name

231 xxx
123
345
111 vvvv

View 5 Replies View Related

SQL & PL/SQL :: Putting Correct Records In Table And Updating

Jun 28, 2011

When I run the code below It runs very Long. It updates SUSR5 in the TEMPTABLE3 that has 112000 records. If I Change it when c>m to 2 to test. It runs very fast. The value for m is always between 10000 and 12000. That How many times it must loop to update the correct records.

DECLARE

a VARCHAR(50);
c NUMBER:= 1;
m NUMBER;

[Code]....

View 23 Replies View Related

SQL & PL/SQL :: Using Sequence To Insert In Child Table Group By A Counter Column

Oct 1, 2011

I found nothing in SQL (all in PL/SQL).I have a table:

create table Parent (pk_id number primary key); --which is filled using sequence seq_Parent.

And I have a child table:

create table Child (rRef number, fk_parent number primary key (rRef, fk_parent);

that I need to insert into Child using seq_parent but I want to insert the same sequence for each group of rRef. I dont know how to do that using SQL not PL/SQL.

View 7 Replies View Related

SQL & PL/SQL :: Entire Insert Script Row Will Be Inserted Into Cbxrdlog Table Sqltext Column

Aug 24, 2011

I have 2 tables. Cbxrd and Cbxrdlog. If the Cbxrd table having creation date column. when it inserts the row. if the column is null value. then the entire insert script row will be inserted into Cbxrdlog table sqltext column.

i have attached the trigger script. when i execute the table but i shows error like

"Ora-0756 Quoted String not properly terminated".
"Ora-04098: trigger os_wm_sit_owner.cbx trigger is invalid and failed revalidation.

View 5 Replies View Related

Forms :: Read Data From Table And Insert To Another Table With A Cursor?

Feb 20, 2013

I have a table with a BLOB column ;

I want read data from table and insert to another table with a cursor

My code is :

procedure read_data is
cursor get_data is
select id,image from picture1;
id1 number;
pic blob;
begin
open get_data;

[code]....

when I run form , error FRM-40734 occurred

error in line " fetch .... "

View 1 Replies View Related

SQL & PL/SQL :: Dynamic Column Creation / Create Column Based On Number Of Child In Hierarchy

Oct 15, 2013

I have one hirarchical query which return the parent to child hirarch level data. it has 11 level child data. i want to create column based on number of child in hirarchy. though i know it is 11 but it can change also.Is there any way i can create the column dynamically

ORG_UNITCOST_CENTERORG_UNIT_NAMEPARENT_ORG_UNITLLSYS_CONNECT_BY_PATH(ORG_UNIT,'/')

500171960000022000Managing Director - LUL500169965/00000001/50000001/50017588/50016996/50017196
500018370000021241FSO500171966/00000001/50000001/50017588/50016996/50017196/50001837
502894940000021241Knowledge Management500018377/00000001/50000001/50017588/50016996/50017196/50001837/50289494
508014980000021241Finance500018377/00000001/50000001/50017588/50016996/50017196/50001837/50801498

View 1 Replies View Related

Performance Tuning :: Correct Method To Determine Table Actual Size

Aug 9, 2012

Which is the correct method to calculate actual data size in a table? becaue when I serach in google, I saw the below line.

"Oracle thumb rule says (actual space required for a table + 30 % space) will calculate the original space requirement for a table."

Method 1:

actual space = num_rows*avg_row_len

Method 2:

actual space = (Num of rows in a table) * (Avg_row_len) + ((Num of rows in a table) * (Avg_row_len)* 0.3)

View 8 Replies View Related

SQL & PL/SQL :: To Insert Data Into A Table

Mar 25, 2010

I'm trying to insert data into a table, but can't seem to get the actual code right, when I put it in, Here is the code I have that is giving me the error:

INSERT INTO Orders VALUES('00001', 'c001', 'ca01', '20.5', TO_DATE('12032009', 'DDMMYYYY');

View 4 Replies View Related

PL/SQL :: Insert Data Into One Table From Other?

Oct 7, 2012

i have one table name called TRXN with 43gb data with primary key...i have other table named TRXN_P with 15gb data...some of the records of TRXN_P are already there in TRXN table....i want to insert that remaining data in TRXN_P into TRXN table?

how can i insert ?

View 6 Replies View Related

Insert Data In Table

May 4, 2013

i created and inserted data to my database using SQL plus. all tables has been created sucsefully and i can see them in OUI. but all tables rows shown empety(it means under the rows, column is empety not 0). now how can see the data which i inserted to tables ? can i see them in OUI?(web interface)

View 12 Replies View Related

SQL & PL/SQL :: Dynamic Insert From Multiple Tables?

May 29, 2013

We get data from our customers which we load into temporary tables.The goal is to consolidate this data into one single table.

Following are the rules:

1) final table should have all the columns from all the tables. If there are common column(s) then add only one column with that name.

2) the join would be based on all the common columns

3) if there is a common row, we merge the row into one (example, the row with DOMAIN = ACME.COM)

4) There could be 'N' number of tables

Following is the most realistic data.

1) T1/T2/T3 has the sample data which cover most of our test cases

2) We are expected to transform the data from T1/T2/T3 as depicted in table T4.

3) we might have more than 3 tables in our production environment, so the query should work for N tables.

4) I have given the explanation of how each row should be derived to be inserted in T4

5) the only information we have to work with is the TABLE_NAME(s) and its metadata from USER_TAB_COLUMNS

DROP TABLE T1;
DROP TABLE T2;
DROP TABLE T3;
DROP TABLE T4;

[code].....

Explanation for each row:

row1) This row comes from T1 and T2 (not T3 because HOSTNAME would not match)
row2) This row comes from T1 and T3 (not T2 because HOSTNAME would not match)
row3) This row comes from T1 and T3
row4) This row comes from T2 and T3
row5) This row comes from T3

View 5 Replies View Related

SQL & PL/SQL :: How To Insert Data From XML File To Table

Jul 2, 2010

use XML package & UTL_FILE package & i had install the software Oracle Database 10g Express Edition, Oracle Client 10g Express Edition & Oracle SQL Developer

I have tried different methods as mentioned below:

XML File : trailxml.xml stored in C:OracleProject

<?xml version = '1.0'?>
<metadata>
<Zipcodes>

[Code].....

View 21 Replies View Related

SQL & PL/SQL :: Insert CLOB Data To The Table?

May 28, 2010

I need to pass a large data into one of the tables where the column is declared as CLOB before which I was checking with the sample code as below which is throwing an error.

I was trying to insert the CLOB data into the table as below.

create table t1
( x number,
y clob
);
insert into t1(x) values (2)
declare
l_clob t1.y%type;

[code].....

The error I am getting is:

ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 833
ORA-06512: at line 161

View 1 Replies View Related

SQL & PL/SQL :: Insert Data Into Lookup Table?

Jan 5, 2012

I have 2 tables, TABLE1 AND LOOKUP_TABLE. The requirement is to insert the distinct (AREA,CITY) from
TABLE1 into LOOKUP_TABLE, where LOOKUP_TABLE.LOOKUP_ID = LOOKUP_SEQ.NEXTVAL;

-- Test Case

DROP SEQUENCE lookup_seq;
CREATE SEQUENCE lookup_seq START WITH 1;
DROP TABLE table1;
CREATE TABLE table1

[code]...

Expected data in LOOKUP_TABLE
LOOKUP_ID AREA CITY
--------- --------- -------
1 area1 city1
2 area2 city2
3 area3 city3
4 area4 city4
5 area5 city5

Currently this is what I'm doing.

INSERT INTO lookup_table SELECT sl_no, area, city FROM table1;
DELETE FROM
lookup_table a
WHERE

[code]...

Is there a better way of doing this, using a single insert statement?

View 8 Replies View Related

Incorrect Data Value When Insert Into Table

Sep 25, 2013

Would like to ask expert here, how could I insert data into oracle table where the value is 03 ? The case is like that,  the column was defined as varchar2(50) data type, and I have a csv file where the value is 03 but when load into oracle table the value become 3 instead of 03.

View 8 Replies View Related

SQL & PL/SQL :: Insert Data Into Object Relational Table

Dec 26, 2010

I had my previous table model as below.

CREATE TABLE Rel_Module (
Id NUMBER (6) PRIMARY KEY,
Type CHAR (7) NOT NULL,

[Code]...

How I can easily load data into this new REL_MODULE table either using SQL or PL/SQL (e.g., Procedures, Functions, and Triggers). I don't need to write so many INSERT statement.

View 20 Replies View Related

SQL & PL/SQL :: Bulk Insert Dummy Data Into Table

Oct 10, 2013

I have a table emp as mentioned below:

SELECT * FROM EMP_TEST;

EMP_TEST
-----------------------------------------------------
ENO EFIRSTNAME ESECONDNAME DEPTNO
1 JOHN PAI 10
2 ABC DEF 20
3 EFG GHI 30

Now the primary key in this above table is pk_emp_test_eno on eno.

I have a requirement where i need to dump some dummy data (600000000 numbers of data ) into the emp_test based on these existing data without disabling the constraints (maintaining unique constraint for each record). And while inserting i want to commit after every 1000 insertion.

in bulk inserting dummy datas into the table as it is taking much more time to insert into the same.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved