kamapisaachi Posted April 24, 2022 Report Share Posted April 24, 2022 ee query lo pid value one value at a time etla pass cheyyali ? pid values are stored in another table called table b. example select * from table a where pid = 2 inko loop iteration lo select * from table b where pid = 3 itla 100-200 times pid value marusthu query run cheyyali. output will be exported to multiple text files. Quote Link to comment Share on other sites More sharing options...
Raazu Posted April 24, 2022 Report Share Posted April 24, 2022 6 minutes ago, kamapisaachi said: ee query lo pid value one value at a time etla pass cheyyali ? pid values are stored in another table called table b. example select * from table a where pid = 2 inko loop iteration lo select * from table b where pid = 3 itla 100-200 times pid value marusthu query run cheyyali. output will be exported to multiple text files. Cursor Quote Link to comment Share on other sites More sharing options...
chandrabhai7 Posted April 24, 2022 Report Share Posted April 24, 2022 No clarity in question Quote Link to comment Share on other sites More sharing options...
naughty15 Posted April 24, 2022 Report Share Posted April 24, 2022 why one at a time? if ur use case is one at time, then cursor. Quote Link to comment Share on other sites More sharing options...
Tenali Posted April 24, 2022 Report Share Posted April 24, 2022 code it in shell script.. step 1) Output pid values to be iterated into a text file... create multiple files accordingly if it requires nested looping. step 2) Use for loop to loop through all pid values from the text files.. redirect the output for every run into flat file according to your requirement. Quote Link to comment Share on other sites More sharing options...
iTeachSAP Posted April 24, 2022 Report Share Posted April 24, 2022 7 hours ago, kamapisaachi said: ee query lo pid value one value at a time etla pass cheyyali ? pid values are stored in another table called table b. example select * from table a where pid = 2 inko loop iteration lo select * from table b where pid = 3 itla 100-200 times pid value marusthu query run cheyyali. output will be exported to multiple text files. Ni daggara linux environment undha? Or python undha? SQL lo ante stored procs lo rayali. Atleast what database ee chepou. Quote Link to comment Share on other sites More sharing options...
Googlie Posted April 24, 2022 Report Share Posted April 24, 2022 declare cursor c_pid as select distinct pid from table b; P_output_value varchar2(1000); Begin For x in c_pid loop select output_value into p_output_value from table a where a.<pid_foriegn_key> = x.pid; dbms_output.print_line(‘value of pid is: ‘ || p_output_value); End loop; end; Quote Link to comment Share on other sites More sharing options...
Googlie Posted April 24, 2022 Report Share Posted April 24, 2022 4 minutes ago, Googlie said: declare cursor c_pid as select distinct pid from table b; P_output_value varchar2(1000); Begin For x in c_pid loop select output_value into p_output_value from table a where a.<pid_foriegn_key> = x.pid; dbms_output.print_line(‘value of pid is: ‘ || p_output_value); End loop; end; This is code for oracle database You can run in sql developer it prints the pid value in output window but if u need to write to a file then you can use a file function like fnd_file or a shell script etc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.