- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: SQL Loader
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2003 06:21 AM
тАО12-01-2003 06:21 AM
SQL Loader
I receive a data file with customer name and date of join.
Sample
Cus100 06/26/01
Cus200 07/23/02
Cus300 10/22/02
Cus400 10/21/03
Cus500 11/26/03
I want to load the above data into a table which has
3 columns (Custnum , Date of join, Status).
For Status column i need to update based on the date of join (DOJ). Like if DOJ >= 06/01/02 and DOJ <=12/31/02 then status = S1 else DOJ >= 01/01/03 and DOJ <=06/01/02 then status = S2 and so on ......
this i can do using an update statement after the sqlload. But i want it to be done while loading itself. Is there any option in sqlload ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2003 06:57 AM
тАО12-01-2003 06:57 AM
Re: SQL Loader
That is a good indicator that you should do things that way.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2003 07:13 AM
тАО12-01-2003 07:13 AM
Re: SQL Loader
http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=1083518.6
http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=FOR&p_id=592224.999
http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=171762.1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2003 07:26 AM
тАО12-01-2003 07:26 AM
Re: SQL Loader
here is an alternative in the form of an awk script:
BEGIN\
{
SQLFILE="custinsert.sql";
print "sqlplus /nolog<
print "connect user/passwd" > SQLFILE;
}
{
DATE=substr($0,14,2) substr($0,8,2) substr($0,11,2);
if ((DATE >= "020601") && (DATE <= "021231"))
STATUS="S1";
if ((DATE >= "030101") && (DATE <= "030630"))
STATUS="S2";
if ((DATE >= "030701") && (DATE <= "031231"))
STATUS="S3";
print "*" DATE "*" STATUS "*";
print "insert into table values($1,$2,"STATUS")" > SQLFILE;
}
END\
{
print "EOF" >> SQLFILE;
}
this is only a rough idea, but should give you an idea how it works.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-02-2003 12:37 AM
тАО12-02-2003 12:37 AM
Re: SQL Loader
BTW external tables use sqlloadr in an transparent manner. So, you are accomplishing running the loader and doing the conditional processing at the same time.
External tables can be good if you receive the file periodically, but for a one time deal. Go with sqlloadr and do the post processing as the others have suggested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-02-2003 09:38 AM
тАО12-02-2003 09:38 AM
Re: SQL Loader
create or replace package password_pkg as
type password_tab_type is table of rowid index by binary_integer;
password_tab password_tab_type;
password_index binary_integer;
end password_pkg;
/
create or replace trigger password_bef_stm_all
before insert or update of password,expiretime,comments on password
begin
password_pkg.password_index := 0;
end;
/
create or replace trigger password_aft_row_all
after insert or update of password,expiretime,comments on password
for each row
begin
password_pkg.password_index := password_pkg.password_index + 1;
password_pkg.password_tab(password_pkg.password_index) := :new.rowid;
end;
/
create or replace trigger password_aft_stm_all
after insert or update of password,expiretime,comments on password
begin
for i in 1 .. password_pkg.password_index loop
update password set passdate = to_date(to_char(sysdate)) where rowid = password_pkg.password_tab(i);
dbms_output.put_line(password_pkg.password_tab(i));
end loop;
password_pkg.password_index := 0;
end;
/
Thanks,
Brian