Home » Developer & Programmer » Forms » Sql Loader Problem
Sql Loader Problem [message #535964] Sun, 18 December 2011 05:37 Go to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
Dear All;
I have a Ctl File as:

Load Data
Infile 'D:\Format.csv'
append
Into table Sale.Import_Emp_Positions_Dtl_Tbl
FIELDS TERMINATED BY ";"
TRAILING NULLCOLS
(User_No, User_Responsility, User_Position)


my csv file have 3 column.

My Code in the button:

Procedure Pu_Uploade_Data_File_Prc Is
	
  Cursor vc_get_emp_data Is
  Select User_No, User_Responsility, User_Position
    From Import_Emp_Positions_Dtl_Tbl;
    
	LC$Fichier            Varchar2(128) ;
	vb_client_to_as       Boolean;
	vn_msg                Number;
Begin
	 Begin 
    Delete Import_Emp_Positions_Dtl_Tbl;
    :System.Message_Level := 25;
     Commit;
    :System.Message_Level := 0;
   End;

  LC$Fichier := PKG_FICHIERS.Selection ;
  If LC$Fichier is not null Then
    :Blk_1.File_Name := LC$Fichier;
  End if ;	

  --vb_client_to_as := WEBUTIL_FILE_TRANSFER.Client_To_AS(:Dept.File_Name, 'C:\FORMAT.Txt');				    
  
  Host('\\10.1.70.186\D\oracle\product\10.2.0\db_2\BIN\sqlldr.exe USERID=Sale/Sale@Sale Control='||'\\10.1.70.186\D\FORMAT.Ctl');
  
  --Host('D:\oracle\product\10.2.0\db_1\BIN\sqlldr.exe USERID=Scott/Tiger@ORCL Control= '|| 'C:\FORMAT.Ctl'); if the db on the server

  --Host('C:\Windows\System32\Cmd.exe /C D:\oracle\product\10.2.0\db_1\BIN\sqlldr.exe USERID=Scott/Tiger@ORCL Control= '|| 'C:\FORMAT.Ctl');
    --Client_Host('Cmd.exe /C DEL C:\Test.Txt');
    		
    Host('Cmd.exe /C DEL C:\Test.Txt');
  Begin 	
  For I In vc_get_emp_data  Loop
  	Insert Into Import_Emp_Positions_Dtl(Import_Id, Import_Date, User_No, User_Position, User_Responsility, User_Id, System_Date) 
  	                             Values (:Blk_1.Import_Id, :Blk_1.Import_Date, I.User_No, I.User_Position, I.User_Responsility, :Global.User, Sysdate);
   End Loop;
   
   :System.Message_Level := 25;
    Commit;
   :System.Message_Level := 0;   
  	                                       
 
   	                                          	                                   
   Go_Block('Blk_2');
   Execute_Query;
  End;  
    
   Begin 
    Delete Import_Emp_Positions_Dtl_Tbl;
    :System.Message_Level := 25;
     Commit;
    :System.Message_Level := 0;
   End;
   
   Exception When Others Then
   	Null;
End;


the case is:
i have the control file at a server and my csv file at my pc...

but nothing happend !!!!

where is the problem ?

[Updated on: Sun, 18 December 2011 05:39]

Report message to a moderator

Re: Sql Loader Problem [message #535969 is a reply to message #535964] Sun, 18 December 2011 07:02 Go to previous messageGo to next message
flyboy
Messages: 1903
Registered: November 2006
Senior Member
aallan wrote on Sun, 18 December 2011 12:37
but nothing happend !!!!

where is the problem ?

I see no problem there - the code does what you told it. This part in the end of the procedure:
   Exception When Others Then
   	Null;
explicitly says to ignore any exception which happened in the procedure code, do nothing and successfully end the procedure.
http://www.orafaq.com/wiki/WHEN_OTHERS

If you care, whether the procedure did something useful and did not fail anywhere, you should firstly remove that exception section at all.
Re: Sql Loader Problem [message #535970 is a reply to message #535969] Sun, 18 December 2011 08:07 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
thx 4 replay
i removed the exceptions but still nothing happend...
any other ideas ?
Re: Sql Loader Problem [message #535979 is a reply to message #535970] Sun, 18 December 2011 13:40 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What software versions do you use?

If you use 6i (or lower), include MESSAGE built-ins to follow script execution. On 9i and above, run the form in debug mode for the same reason.

"Nothing happens" means exactly what? How did the form respond to your commands? Did CMD window open at all? Was SQL*Loader's LOG file created? If so, what is its contents?

Note that - on web deployed applications - HOST executes files on the application server machine (not the client - i.e. your own PC).
Re: Sql Loader Problem [message #536194 is a reply to message #535979] Mon, 19 December 2011 13:18 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
thx littlefoot for reply..
im using form 10...
i had a headace from this problem, i tried all of possible solution but didnt work...!
i used cmd to copy file from client pc to a server cuz i dont have AS on the server and it copied well.
i dont know where is the problem !!!!!
Re: Sql Loader Problem [message #536204 is a reply to message #536194] Mon, 19 December 2011 14:23 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Me neither; though, maybe (just maybe) I might get some ideas if you answered my questions.
Re: Sql Loader Problem [message #536253 is a reply to message #536204] Tue, 20 December 2011 01:02 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
dears;
i tried to execute my code from cmd and i got this error message:
/forum/fa/9642/0/

after this error message, it gave me access is denied !!

why ?
  • Attachment: 1.PNG
    (Size: 27.43KB, Downloaded 2169 times)

[Updated on: Tue, 20 December 2011 01:04]

Report message to a moderator

Re: Sql Loader Problem [message #536258 is a reply to message #536253] Tue, 20 December 2011 01:31 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You already are in the CMD window (it is that black window you see).

I didn't quite get it ... you are trying to run SQL*Loader located on another machine, the same that contains your CSV file and SQL*Loader's control file? If so, and regarding the fact that HOST executes files on your application server, maybe you don't even need to specify the whole path. What happens if you use
sqlldr sale/sale@sale control=format.ctl
in form's HOST command? Of course, SQL*Loader must be installed on the server.
Re: Sql Loader Problem [message #536260 is a reply to message #536258] Tue, 20 December 2011 01:38 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
thx littlefoot for reply,
ya i run sql loader from another machine, and control file contains the csv file, but i dont have an application server, i copied the csv file from client to server by :
Client_Host('Cmd.exe /C Copy C:\Format.Csv \\10.1.70.186\D\Format.Csv');

and its copied successfully.

i tried to run script you wrote and the result is:
/forum/fa/9643/0/
  • Attachment: 3.PNG
    (Size: 15.38KB, Downloaded 2341 times)

[Updated on: Tue, 20 December 2011 01:39]

Report message to a moderator

Re: Sql Loader Problem [message #536261 is a reply to message #536260] Tue, 20 December 2011 01:40 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, that's rather obvious - you need to provide valid credentials. I just copied what I read in your previous message; I have no idea whether user SALE identified by SALE exists in a database whose alias is SALE.
Re: Sql Loader Problem [message #536262 is a reply to message #536261] Tue, 20 December 2011 01:45 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
its exist..
sale/sale@sale on the server !
Re: Sql Loader Problem [message #536265 is a reply to message #536262] Tue, 20 December 2011 01:49 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Oracle disagrees.
Re: Sql Loader Problem [message #536266 is a reply to message #536265] Tue, 20 December 2011 01:49 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
ok, how may check about that ?
Re: Sql Loader Problem [message #536270 is a reply to message #536266] Tue, 20 December 2011 01:53 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Wrong database:
M:\>sqlplus scott/tiger@db_does_not_exist

SQL*Plus: Release 11.2.0.2.0 Production on Uto Pro 20 08:51:40 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Wrong password:
M:\>sqlplus scott/lion@ora10

SQL*Plus: Release 11.2.0.2.0 Production on Uto Pro 20 08:51:55 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied


Wrong username:
M:\>sqlplus littlefoot/tiger@ora10

SQL*Plus: Release 11.2.0.2.0 Production on Uto Pro 20 08:52:56 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied


Correct username, password and a database:
M:\>sqlplus scott/tiger@ora10

SQL*Plus: Release 11.2.0.2.0 Production on Uto Pro 20 08:53:27 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL>
Re: Sql Loader Problem [message #536271 is a reply to message #536270] Tue, 20 December 2011 02:00 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
thx agian,
look to the picture:
/forum/fa/9644/0/
  • Attachment: 4.PNG
    (Size: 16.52KB, Downloaded 2364 times)

[Updated on: Tue, 20 December 2011 02:00]

Report message to a moderator

Re: Sql Loader Problem [message #536276 is a reply to message #536271] Tue, 20 December 2011 02:32 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Right; according to that, SQL*Loader should have connected to the database. Now that's funny (and I have no idea what might be wrong here). Maybe someone else knows. If anything comes on my mind, I'll be back.
Re: Sql Loader Problem [message #536277 is a reply to message #536276] Tue, 20 December 2011 02:37 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
thx littlefoot,
may you connect to my pc via teamviwer and check from your side ?
Re: Sql Loader Problem [message #536308 is a reply to message #536277] Tue, 20 December 2011 03:59 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
Looks like you have multiple oracle client installs. Sqlplus is version 10.1.0.4.2 and sqlloader is 10.2.0.1.0.
Presumably each is looking at a different tnsnames.ora file and one of those files is using the wrong DB.
You should use the TNS_ADMIN registry setting to ensure all oracle client installs are using the same tnsnames.ora
Re: Sql Loader Problem [message #536330 is a reply to message #536308] Tue, 20 December 2011 05:25 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
thx cookie for reply..

You should use the TNS_ADMIN registry setting to ensure all oracle client installs are using the same tnsnames.ora

how can i do that ?
Re: Sql Loader Problem [message #536336 is a reply to message #536330] Tue, 20 December 2011 05:28 Go to previous message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As described here.
Previous Topic: Temporarily pause Forms execution
Next Topic: combo box problem when running form using JRE
Goto Forum:
  


Current Time: Thu Jul 25 21:30:27 CDT 2024