Home » RDBMS Server » Server Utilities » to insert data into a particular posistion that has missed
to insert data into a particular posistion that has missed [message #234461] Tue, 01 May 2007 12:28 Go to next message
pravin9
Messages: 42
Registered: May 2007
Member
Hi,
1.while inserting data into temp table using sql loader if one record has missed out how could i insert it into the posistion i require(i.e if 4th record has missed i need to insert it into 4th posistion) how do i do it

2.if i need to insert data in which one coloumn has , as part of data and that coloumn may have one or more multiple , how do i upload such data and the fact file is , seperated file

could u people help me out with this

thanks for ur time in advance
Re: to insert data into a particular posistion that has missed [message #234464 is a reply to message #234461] Tue, 01 May 2007 12:39 Go to previous messageGo to next message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
There's no "4th position" in a table (unless you keep information about it using, for example, a sequence); order of records is to be done using the ORDER BY clause of the SELECT statement. So, insert it afterwards using the INSERT INTO statement or make sure it doesn't fail during the loading session (so that it ends up in either BAD or DISCARD file).

I have no idea what you have asked in the second question. Could you explain it once again, please?
Re: to insert data into a particular posistion that has missed [message #234467 is a reply to message #234461] Tue, 01 May 2007 12:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68663
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Could you post:
1/ your Oracle question (once more we have to ask you this)
2/ a small test case

Regards
Michel
Re: to insert data into a particular posistion that has missed [message #234521 is a reply to message #234467] Wed, 02 May 2007 00:21 Go to previous messageGo to next message
pravin9
Messages: 42
Registered: May 2007
Member
Hi,
1.While uploading data from flatfile to target table using sql loader

flat file:
ename sal job deptno
praveen 1500 analyst 40
pradeep 2500 manager 30
keerthi 4800 manager 30
shiva 1800 analyst 40
suma 2000 programmer 20

while inserting 4th record shiva has missed out and its been discarded now i want to insert that record exactly in 4th posistion can i do that
If there is no index or sequence on that table how could i do it
If there exists a sequence how do i do it

2.My flat file looks this way

empno ename sal job
1467 swetha 10,000,500 manager
1356 anil 1,00,000,000 manager
this flat file is a , seperated file how do i upload the sal col
because this col could contain one or more commas with in it

could u people help me out regarding this

thanks for ur time in advance

Re: to insert data into a particular posistion that has missed [message #234529 is a reply to message #234521] Wed, 02 May 2007 01:01 Go to previous messageGo to next message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Fix Shiva's record so that it won't be discarded any more. Or, alternatively, modify table description (column datatype, length, constraints, ...) so that this record gets inserted.

Once again: there is NO 4th position. Order of records is achieved only by ORDER BY clause.

You could, however, add a sequence number (if you could) to the flat file so that it would look like
1 praveen
2 pradeep
3 keerthi
4 shiva
5 suma
Doing so, after loading session you'd be able to say "OK, Shiva's number is 4".

Your second file isn't comma separated - the only comma(s) I see are those in the SAL column. So, either you didn't post real sample file or there's no problem at all.
Re: to insert data into a particular posistion that has missed [message #234534 is a reply to message #234529] Wed, 02 May 2007 01:13 Go to previous messageGo to next message
pravin9
Messages: 42
Registered: May 2007
Member
hi,

My flat file looks this way
102,praveen,system,10,100,999
103,alex,manager,99,444,666

here my problem is that i need to upload data and the number of commas for the fourth col is not specified it might have one two or three or so

could u help me out regarding this
Re: to insert data into a particular posistion that has missed [message #234549 is a reply to message #234534] Wed, 02 May 2007 01:52 Go to previous messageGo to next message
Michel Cadot
Messages: 68663
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Put " around your figures.
If you can't then tell me how someone can say that 10,100,999 is 10100999 or 10 and 100 and 999 or 10100 and 999?

If you can answer this last question then you can do it with SQL*Loader. If you can't then how a program can?

Regards
Michel
Re: to insert data into a particular posistion that has missed [message #234553 is a reply to message #234549] Wed, 02 May 2007 02:27 Go to previous messageGo to next message
pravin9
Messages: 42
Registered: May 2007
Member
Hi,
Seems i did not explain my problem exactly as i am new to this field i had some doubts

i want to upload a file which has , as a part of the field
eno ename sal
101,praveen,kumar,naidu 5000

i want the target file to be uploaded with ename as praveenkumarnaidu
or
praveen,kumar,naidu

i would like to know if there is a solution for both the outputs

could u help me with a detailed description as to how my ctl file should look for this

thanks for ur time in advance




Re: to insert data into a particular posistion that has missed [message #234561 is a reply to message #234553] Wed, 02 May 2007 02:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68663
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Seems you don't understand my answer. There is no difference between number of strings.
How can you tell that "praveen,kumar,naidu" is "praveenkumarnaidu" or "praveenkumar" and "naidu" or "praveen" and "kumar" and "naidu" or... if your fields are separated by ","?

Regards
Michel
Re: to insert data into a particular posistion that has missed [message #234618 is a reply to message #234549] Wed, 02 May 2007 13:00 Go to previous messageGo to next message
pravin9
Messages: 42
Registered: May 2007
Member
Hi
My flat file consists of large amount of data

sample flat file:
empno ename job
102,praveen,kumar,naidu,manager
104,keerthi,laxman,analyst

where do i need to specify '' so that it can treat the whole field as a single coloumn
as the flat file doesnt have 'praveen,kumar,naidu'and it is not possible to do it manually
can i specify it in the control file
can u provide me with a sample control file as to how i do it

Re: to insert data into a particular posistion that has missed [message #234621 is a reply to message #234618] Wed, 02 May 2007 13:08 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
By recreating your flat file with quotes around the data that you want in the single column.
Re: to insert data into a particular posistion that has missed [message #234622 is a reply to message #234618] Wed, 02 May 2007 13:09 Go to previous messageGo to next message
Michel Cadot
Messages: 68663
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If I give you this file:
empno ename job
102,michel,cadot,directeur,general
104,jean,marcel,louis,consultant
10,100,charlotte,corday,meurtriere

I said you, fields are separated by ','
Can you give me for each line:
- empno
- ename
- job

Just answer this question, with just what I gave.

Regards
Michel
Re: to insert data into a particular posistion that has missed [message #234626 is a reply to message #234621] Wed, 02 May 2007 13:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68663
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is what I'm trying to say since several hours but he still answers:
Quote:
the flat file doesnt have 'praveen,kumar,naidu'and it is not possible to do it manually

Regards
Michel
Re: to insert data into a particular posistion that has missed [message #234627 is a reply to message #234621] Wed, 02 May 2007 13:19 Go to previous messageGo to next message
pravin9
Messages: 42
Registered: May 2007
Member
Hi,
Can i restructure the flatfile so as to include '' for a specified col in a single go without doing it manually .if so could u explain me how it could be done
Re: to insert data into a particular posistion that has missed [message #234628 is a reply to message #234627] Wed, 02 May 2007 13:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68663
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How do you get the file?
Which process/program generates it?
Just modify this one to put " or ' or any character you want at right place.

Regards
Michel
Re: to insert data into a particular posistion that has missed [message #234635 is a reply to message #234628] Wed, 02 May 2007 13:34 Go to previous messageGo to next message
pravin9
Messages: 42
Registered: May 2007
Member
Hi,
I dont know how to explain this problem it was an interview question for me they asked how do u upload data if a coloumn contains , as a part of the data and this file is a , seperated file.

Anyway i appreciate ur patience in trying to explain it to me
thanks
Re: to insert data into a particular posistion that has missed [message #234636 is a reply to message #234635] Wed, 02 May 2007 13:35 Go to previous messageGo to next message
Michel Cadot
Messages: 68663
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The answer is: As it you can't load correctly this file.

Regards
Michel
Re: to insert data into a particular posistion that has missed [message #234639 is a reply to message #234636] Wed, 02 May 2007 13:37 Go to previous messageGo to next message
pravin9
Messages: 42
Registered: May 2007
Member
thanks michael
to display data in a report based on the number of records [message #234710 is a reply to message #234621] Thu, 03 May 2007 00:36 Go to previous messageGo to next message
pravin9
Messages: 42
Registered: May 2007
Member
Hi,
1.i wanted to display data in a report which has this condition
if i have 5 records or less i need to display it in the first page.
otherwise i need to display the first page blank and start displaying from second page

2.how do i display running total for a report

thanks for ur time in advance
Re: to display data in a report based on the number of records [message #234726 is a reply to message #234710] Thu, 03 May 2007 00:58 Go to previous message
Michel Cadot
Messages: 68663
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Same answer as in your other post.
http://www.orafaq.com/forum/t/81027/102589/
Don't multipost your question.

Regards
Michel
Previous Topic: Sql*Loader conventional path - lock table ?
Next Topic: NEWBIE: First time using SQL*Loader, plz help
Goto Forum:
  


Current Time: Tue Jun 18 08:30:36 CDT 2024