|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Quote:
You have a typo: PHP Code:
Also, the directory name in UTL_FILE.OPEN() procedure has to be a directory object name (see CREATE DIRECTORY). ![]()
__________________
|
|
#3
|
|||
|
|||
|
I am sorry i dint get that... and you explain me again plzz
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Help with the Procedure and its cursor |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|