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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 6th, 2008, 09:47 AM
Nallagangu Nallagangu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 22 Nallagangu New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 5 h 6 m 16 sec
Reputation Power: 0
Help with the Procedure and its cursor

Hi,
I was trying to extract some data from tables to external text file using concept of UTL... i have written a procedure which have some errors and i am not understanding how to slove it.... this is my second procedure i am writing so my mistakes may be silly or unconceptional.... but please try to helping me... i am learn from my mistakes

Procedure

SQL> Create or replace procedure SAP_TOT_HRS_PER_PC (
2 v_brand_ic NUMBER,
3 v_manf_loc_id VARCHAR2
4 )
5 is
6 output_file utl_file.file_type;
7 o_filename VARCHAR2(50):= 'SAP_TOT_HRS_PER_PC.TXT';
8 o_DataDir CONSTANT VARCHAR2 (30) := '/d014/oradata/temp';
9 Asse_Part_NBR INTEGER;
10 Tot_hrs_per_pec INTEGER;
11 Part_describe VARCHAR2(50);

12 CURSOR Tot_hrs IS select Assembly_Part_NBR,
13 Total_hrs_per_piece,
14 Part_DESC
15 from mpc.total_hrs_per_piece_view
16 where brand_id= v_brand_id AND
17 MANF_LOC_ID= v_manf_loc_id;
18
19 begin
20
21 output_File := UTL_FILE.FOPEN (o_DataDir, o_FileName, 'w');
22
23 OPEN tot_hrs;
24 loop
25 fetch tot_hrs into asse_part_NBR, tot_hrs_per_pec, part_describe;
26 end loop;
27
28
29 UTL_FILE.PUT_LINE (output_File, asse_part_NBR|| ' ' || tot_hrs_per_pec || ' ' || part_describe );
30
31
32 UTL_FILE.FCLOSE (output_File);
33
34 END SAP_TOT_HRS_PER_PC;;

ERRORS

LINE/COL ERROR
-------- ---------------------------------------------------
12/19 PL/SQL: SQL Statement ignored
16/17 PL/SQL: ORA-00904: "V_BRAND_ID": invalid identifier

I know there is something wrong with the cursor and i am not knowing how to slove it...

Please help me..

Thank You

Reply With Quote
  #2  
Old May 6th, 2008, 10:08 AM
LKBrwn_DBA LKBrwn_DBA is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 294 LKBrwn_DBA User rank is Sergeant (500 - 2000 Reputation Level)LKBrwn_DBA User rank is Sergeant (500 - 2000 Reputation Level)LKBrwn_DBA User rank is Sergeant (500 - 2000 Reputation Level)LKBrwn_DBA User rank is Sergeant (500 - 2000 Reputation Level)LKBrwn_DBA User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 16 h 48 m 15 sec
Reputation Power: 9
Talking

Quote:
ORA-00904: "V_BRAND_ID": invalid identifier

You have a typo:

PHP Code:
 CREATE ...
2 v_brand_ic NUMBER,
... 

Also, the directory name in UTL_FILE.OPEN() procedure has to be a directory object name (see CREATE DIRECTORY).
Comments on this post
pabloj agrees!
__________________

Reply With Quote
  #3  
Old May 12th, 2008, 08:04 AM
Nallagangu Nallagangu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 22 Nallagangu New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 5 h 6 m 16 sec
Reputation Power: 0
I am sorry i dint get that... and you explain me again plzz

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Help with the Procedure and its cursor


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 4 hosted by Hostway