Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
-none-

-none-

2004-06-16       - By -not available-
Reply:     <<     111     112     113     114     115     116     117     118     119     120     >>  

If that is the case, I would import the data to a temp table.
CREATE TABLE temp
(id varchar2(1),
Generic_num varchar2(20),
Generic_Name varchar2(20));

Then write a stored procedure to do the insert statements to your real
tables.

Declare a cursor of
Cursor cur is
SELECT * from temp;
And some variables to store your data:

V_dept_no varchar2(50);

Then, in your procedure body:

FOR cur_rec IN cur LOOP
IF cur_rec.id = '1 ' THEN
/*new department*/
V_dept_no:= cur_rec.generic_num;
INSERT INTO dept (deptno, deptname)
VALUES (cur_rec.generic_num, cur_rec.generic_name);

ELSIF cur_rec.id= '2 ' THEN
/*employee record*/
INSERT INTO emp ( deptno, empno, empname)
VALUES (V_dept_no, cur_rec.generic_num, cur_rec.generic_name);
END IF;
END LOOP;
COMMIT;

Please note:
This assumes that your first record is a department record and that the way
the data retrieved from the cursor is in the same order that it was in the
datafile used for the import.

HTH,
Melissa Paglia

-- --Original Message-- --
From: oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)]
On Behalf Of Kevin Lange
Sent: Wednesday, June 16, 2004 4:25 PM
To: 'oracle-l@(protected) '
Subject: SQL Loader Question on 8.1.7

Evening;
I figured if anyone would know ... you all would. Here is a simple
example given in the Oracle SQLLDR manual:

You have conditional data in a singl file to be loaded into different
tables:

1 50 Manufacturing
2 1100 Smith
2 1200 Snyder
1 60 Shipping
2 1121 Stevens

Based on the Record ID, you want either the Department or the Employee
table to be loaded:

Into Table dept
When recid = 1
(recid Position(1:1) Integer External,
deptno Position(3:4) Integer External,
depname Position(8:21) Char)
Into Table emp
When recid = 2
(recid Position(1:1) Integer External,
empno Position(3:6) Integer External,
empname Position(8:17) Char
commission Position(19:25))

That is fairly simple.

It gets more difficult when you ask the question .... Can you carry the
data from one of the When sections over into another section ?? i.e. Is
there a way to make a presistant variable that is set in one section and
then used in another section ??

Using the sample above, we need to have the "Department Number " (depno)
inserted into the EMP table without having to add it to each individual
record where recid = 2 since it is already on the record where recid = 1.


Any help or direction to go for samples if possible would be greatly
appreciated.

Kevin
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --


"Bringing people together to advance their lives. "


-- ---_=_NextPart_001_01C453ED.A069DB7F
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN " >
<HTML >
<HEAD >
<META HTTP-EQUIV=3D "Content-Type " CONTENT=3D "text/html; =
charset=3Dus-ascii " >
<META NAME=3D "Generator " CONTENT=3D "MS Exchange Server version =
5.5.2653.12 " >
<TITLE >RE: SQL Loader Question on 8.1.7 </TITLE >
</HEAD >
<BODY >

<P > <FONT SIZE=3D2 >Hi Kevin- </FONT >
</P >

<P > <FONT SIZE=3D2 >From the sample data you provided, it looks like the =
only way to know which department the employee is from is that the =
department precedes the employee record.  Not an easy =
relation.  </FONT > </P >

<P > <FONT SIZE=3D2 >If that is the case, I would import the data to a =
temp table. </FONT >
<BR > <FONT SIZE=3D2 >CREATE TABLE temp </FONT >
<BR > <FONT SIZE=3D2 >  (id varchar2(1), </FONT >
<BR > <FONT SIZE=3D2 >   Generic_num  varchar2(20), </FONT >
<BR > <FONT SIZE=3D2 >   Generic_Name  =
varchar2(20)); </FONT >
</P >

<P > <FONT SIZE=3D2 >  Then write a stored procedure to do the insert =
statements to your real tables. </FONT >
</P >

<P > <FONT SIZE=3D2 >Declare a cursor of </FONT >
<BR > <FONT SIZE=3D2 >  Cursor cur is </FONT >
<BR > <FONT SIZE=3D2 >    SELECT * from temp; </FONT >
<BR > <FONT SIZE=3D2 >And some variables to store your data: </FONT >
</P >

<P > <FONT SIZE=3D2 >V_dept_no  varchar2(50); </FONT >
</P >

<P > <FONT SIZE=3D2 >Then, in your procedure body: </FONT >
</P >

<P > <FONT SIZE=3D2 >FOR cur_rec IN cur LOOP </FONT >
<BR > <FONT SIZE=3D2 >    IF cur_rec.id =3D '1 ' THEN </FONT >
<BR > <FONT SIZE=3D2 >       /*new =
department*/ </FONT >
<BR > <FONT SIZE=3D2 >      V_dept_no:=3D =
cur_rec.generic_num; </FONT >
<BR > <FONT SIZE=3D2 >      INSERT INTO dept =
(deptno, deptname) </FONT >
<BR > <FONT SIZE=3D2 >      VALUES =
(cur_rec.generic_num, cur_rec.generic_name); </FONT >
</P >

<P > <FONT SIZE=3D2 >    ELSIF cur_rec.id=3D '2 ' THEN </FONT >
<BR > <FONT SIZE=3D2 >       /*employee =
record*/ </FONT >
<BR > <FONT SIZE=3D2 >      INSERT INTO emp ( =
deptno, empno, empname) </FONT >
<BR > <FONT SIZE=3D2 >      VALUES =
(V_dept_no,  cur_rec.generic_num, cur_rec.generic_name); </FONT >
<BR > <FONT SIZE=3D2 >     END IF; </FONT >
<BR > <FONT SIZE=3D2 >END LOOP; </FONT >
<BR > <FONT SIZE=3D2 >COMMIT; </FONT >
</P >

<P > <FONT SIZE=3D2 >Please note: </FONT >
<BR > <FONT SIZE=3D2 >This assumes that your first record is a department =
record and that the way the data retrieved from the cursor is in the =
same order that it was in the datafile used for the import. </FONT > </P >

<P > <FONT SIZE=3D2 >HTH, </FONT >
<BR > <FONT SIZE=3D2 >Melissa Paglia </FONT >
</P >

<P > <FONT SIZE=3D2 >-- --Original Message-- -- </FONT >
<BR > <FONT SIZE=3D2 >From: oracle-l-bounce@(protected) [ <A =
HREF=3D "mailto:oracle-l-bounce@(protected) " >mailto:oracle-l-bounce@(protected)=
elists.org </A >] On Behalf Of Kevin Lange </FONT >
<BR > <FONT SIZE=3D2 >Sent: Wednesday, June 16, 2004 4:25 PM </FONT >
<BR > <FONT SIZE=3D2 >To: 'oracle-l@(protected) ' </FONT >
<BR > <FONT SIZE=3D2 >Subject: SQL Loader Question on 8.1.7 </FONT >
</P >

<P > <FONT SIZE=3D2 >Evening; </FONT >
<BR > <FONT SIZE=3D2 >  I figured if anyone would know ... you all =
would.   Here is a simple </FONT >
<BR > <FONT SIZE=3D2 >example given in the Oracle SQLLDR manual: </FONT >
</P >

<P > <FONT SIZE=3D2 >  You have conditional data in a singl file to =
be loaded into different </FONT >
<BR > <FONT SIZE=3D2 >tables: </FONT >
<BR > <FONT SIZE=3D2 >  </FONT >
<BR > <FONT SIZE=3D2 >    1  50  =
Manufacturing </FONT >
<BR > <FONT SIZE=3D2 >    2  1100  Smith  =
</FONT >
<BR > <FONT SIZE=3D2 >    2  1200 Snyder  </FONT >
<BR > <FONT SIZE=3D2 >    1  60  Shipping </FONT >
<BR > <FONT SIZE=3D2 >    2  1121  Stevens  =
</FONT >
</P >

<P > <FONT SIZE=3D2 >  Based on the Record ID, you want either the =
Department or the Employee </FONT >
<BR > <FONT SIZE=3D2 >table to be loaded: </FONT >
</P >

<P > <FONT SIZE=3D2 >    Into Table dept </FONT >
<BR > <FONT SIZE=3D2 >      When recid =3D =
1 </FONT >
<BR > <FONT SIZE=3D2 >      (recid Position(1:1) =
Integer External, </FONT >
<BR > <FONT SIZE=3D2 >       deptno =
Position(3:4) Integer External, </FONT >
<BR > <FONT SIZE=3D2 >       depname =
Position(8:21) Char) </FONT >
<BR > <FONT SIZE=3D2 >    Into Table emp </FONT >
<BR > <FONT SIZE=3D2 >      When recid =3D =
2 </FONT >
<BR > <FONT SIZE=3D2 >      (recid Position(1:1) =
Integer External, </FONT >
<BR > <FONT SIZE=3D2 >       empno =
Position(3:6) Integer External, </FONT >
<BR > <FONT SIZE=3D2 >       empname =
Position(8:17) Char </FONT >
<BR > <FONT SIZE=3D2 >       commission =
Position(19:25)) </FONT >
</P >

<P > <FONT SIZE=3D2 >That is fairly simple. </FONT >
</P >

<P > <FONT SIZE=3D2 >It gets more difficult when you ask the =
question  ....  Can you carry the </FONT >
<BR > <FONT SIZE=3D2 >data from one of the When sections over into another =
section ??  i.e. Is </FONT >
<BR > <FONT SIZE=3D2 >there a way to make a presistant variable that is =
set in one section and </FONT >
<BR > <FONT SIZE=3D2 >then used in another section ?? </FONT >
<BR > <FONT SIZE=3D2 >       </FONT >
<BR > <FONT SIZE=3D2 >Using the sample above, we need to have the =
"Department Number" (depno) </FONT >
<BR > <FONT SIZE=3D2 >inserted into the EMP table without having to add it =
to each individual </FONT >
<BR > <FONT SIZE=3D2 >record where recid =3D 2 since it is already on the =
record where recid =3D 1. </FONT >
</P >
<BR >

<P > <FONT SIZE=3D2 >Any help or direction to go for samples if possible =
would be greatly </FONT >
<BR > <FONT SIZE=3D2 >appreciated. </FONT >
</P >

<P > <FONT SIZE=3D2 >Kevin </FONT >
<BR > <FONT =
SIZE=3D2 >-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----=
- </FONT >
<BR > <FONT SIZE=3D2 >Please see the official ORACLE-L FAQ: <A =
HREF=3D "http://www.orafaq.com " =
TARGET=3D "_blank " >http://www.orafaq.com </A > </FONT >
<BR > <FONT =
SIZE=3D2 >-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----=
- </FONT >
<BR > <FONT SIZE=3D2 >To unsubscribe send email to:  =
oracle-l-request@(protected) </FONT >
<BR > <FONT SIZE=3D2 >put 'unsubscribe ' in the subject line. </FONT >
<BR > <FONT SIZE=3D2 >-- </FONT >
<BR > <FONT SIZE=3D2 >Archives are at <A =
HREF=3D "http://www.freelists.org/archives/oracle-l/ " =
TARGET=3D "_blank " >http://www.freelists.org/archives/oracle-l/ </A > </FONT >=

<BR > <FONT SIZE=3D2 >FAQ is at <A =
HREF=3D "http://www.freelists.org/help/fom-serve/cache/1.html " =
TARGET=3D "_blank " >http://www.freelists.org/help/fom-serve/cache/1.html </=
A > </FONT >
<BR > <FONT =
SIZE=3D2 >-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----=
-- </FONT >
</P >
<BR >

<P > <I > <B > <FONT SIZE=3D2 >"Bringing people together to advance their =
lives." </FONT > </B > </I >=20
</P >

</BODY >
</HTML >
-- ---_=_NextPart_001_01C453ED.A069DB7F--
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --