Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 18th, 2004, 06:11 AM
Barry1970 Barry1970 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 Barry1970 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Alternative to UTL_FILE

I have an issue where i need to create two fixed length interface files which in itself is not an issue and i have done this many times.

I do however have the restriction of being on 9i and there being no directories set in all_directories which is preventing me from using the UTL_FILE package.

This is a vendor database and i cannot create any tables an although i could spool the files this is not what i wanted to use

anyone have any ideas of an alternative , the best i can do is use an anonomous block.

Reply With Quote
  #2  
Old June 18th, 2004, 09:18 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 28 m 57 sec
Reputation Power: 48
Most OS support some type of redirection - on Unix we do this kind of thing to get around the problem, using DBMS_OUTPUT which lets you format stream output

Code:
        
  VALUE="13"
  UIPW=username/password
  echo "$UIPW
 SET SERVEROUT ON SIZE 1000000
 DECLARE
  
  cursor whatever is  
  SELECT
      usbsubm_status stat
  from usbsubm
  WHERE usbsubm_job = 'UZERTEX'
    AND usbsubm_number = $VALUE;
  BEGIN
   FOR X IN whatever 
   LOOP
          DBMS_OUTPUT.put_line('Record status:'|| x.stat);
   END LOOP;
 END;
 /" | 
  $ORACLE_HOME/bin/sqlplus -s > /path/to/output/file

Reply With Quote
  #3  
Old June 18th, 2004, 09:35 AM
Barry1970 Barry1970 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 Barry1970 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Jim ,

Am on a Unix box so this should be ok however any idea on how i can check the files exists ?

In your opinion would the only way to be to have this in a shell script or can you think off a clever sql/plsql method ?

Barry

Reply With Quote
  #4  
Old June 18th, 2004, 11:54 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 28 m 57 sec
Reputation Power: 48
I assume you mean the output file already exists

Code:
if [ -s /path/to/output/file ] ; then
   #--- do stuff with cat, mv or rm on the old file here
   #--- example
   mv /path/to/output/file /path/to/another/file.old
fi 


PL/SQL allows output to:
1.stdout (dbms_output package)
2.files in specifed directories (utl_file package)
3.spool dbms_output to a file, but you said that spool won't work.

That's it. All I know about.

Except - if you have Oracle, you may have Pro*C installed.
You can write C code that opens the database and writes a file anywhere - using embedded PL/SQL blocks to get the data.

Code:
EXEC SQL EXECUTE
..PL/SQL BLOCK here
END-EXEC;


The $ORACLE_HOME path has pro*c code examples - the files end in .pc

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Alternative to UTL_FILE


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway