Hey Javier, Maybe I'm missing the point of your question (it doesn't seem related to this thread), but there's not much to this really - and it's oddly coded.
Basically there's a p_concurrent_request_id parameter to the report (likely the request that was submitted) and this code grabs the outfile_name (path and filename) from fnd_concurrent_requests. It then does nothing with this information. Presumably, this is simply a check that argument1 of the current request is '2EXCEL', though if that is somehow optional, an exception handler to return FALSE (or log the NO_DATA_FOUND error) would have been a good idea. If this parameter is not optional, it's redundant code. Next it simply takes the nextval from a sequence and updates argument25 of this request with that sequence number and issues a commit (???? you can let Oracle's request submission take care of that - this is in the afterreport, but I still wouldn't do it). This functionality could have been done as one of the parameters on the concurrent request parameter definition screen if it was necessary to store it. I would definitely be asking "what's the point" to whomever coded this. -T. On May 6, 11:43 am, Javier Montani <jmont...@gmail.com> wrote: > I found this in a report. Can someone explain how it works? > > function AfterReport return boolean is > VDbFile Number; > VOutFileName VarChar2(255); > begin > Select OutFile_Name Into VOutFileName > from fnd_concurrent_requests > where request_id = :P_Conc_Request_Id > And Argument1 = '2EXCEL'; > > Select Fnd_Lobs_S.NextVal Into VDbFile From Dual ; > > Update Fnd_Concurrent_Requests > Set Argument25 = To_Char(VDbFile) > Where Request_Id = :P_Conc_Request_Id; > Commit; > End If; > > return (TRUE); > end; > > 2009/4/23 John <johnysm...@gmail.com> > > > > > > > Hi Rob, > > I am sorry that I mentioned it as excel and also not giving much info. > > I am on Linux environment and the data should be dumped to .tsv file > > and not other format as it is the way this app is setup. > > > Here is my scenario.. > > > 1) I have a sample.tsv file which some data as below, > > > col1 col2 col3 > > xyz1 xyz2 xyz3 > > xyz4 xyz5 xyz6 > > > 2) I need to have a script which runs some queries, check some > > validations etc etc and extracts the data from DB and appends to the > > above sample.tsv file as follows. > > > id col1 col2 col3 > > 1 xyz1 xyz2 xyz3 > > 2 xyz4 xyz5 xyz6 > > > 3) Now I pick this sample.tsv file and feed it to some other command > > to insert the data contained in it to DB tables in another > > environment. > > > So I wanted to know the process to automate this process, as how to > > start about and what scripting language is suggested. > > I hope I am clear. I am totally new to this hence need some pointers. > > > Thanks for all your hep. > > John > > > On Apr 23, 5:31 am, rob wolfe <rob.wo...@oraclegeeks.com> wrote: > > > Just want to reinforce that my post wasn't meant to be a personal > > > criticism of Iyad. It is just that his solution, while the answer to a > > > common problem, was not the answer to the problem posed and I would hate > > > for the OP to go down the garden path. > > > > Rob > > > > Mouhammed Iyad wrote: > > > > > Nice Morning Dear, > > > > > I have an Idea, > > > > > I used to face the same problem but I find a good solution, > > > > > first you have to create an ODBC connection to oracle, > > > > > then easily you can make a connection in Excel file can read from > > > > Oracle using ODBC & whenever you like you could refresh the data, > > > > > It's fast & easy, > > > > > Best Regards, > > > > > Iyad > > > > > 2009/4/23 Rob Wolfe <rob.wo...@oraclegeeks.com > > > > <mailto:rob.wo...@oraclegeeks.com>> > > > > > On Wed, April 22, 2009 18:26, John wrote: > > > > > > can anyone please help... No gurus in this groups can suggest > > > > > something ? > > > > > > On Apr 22, 7:30 am, John <johnysm...@gmail.com > > > > <mailto:johnysm...@gmail.com>> wrote: > > > > >> For a small automation project I have to extract data from a > > table/ > > > > >> tables and append it to the existing excel file and feed that > > excel > > > > >> file to a command that will load data into some other > > > > environment. I > > > > >> am totally new to this. So to get started I wanted to know, > > > > >> 1) How to extract data from sample table Foo which has columns > > > > A,B,C > > > > >> and append these values as new columns to an existing excel say > > > > >> fooresults.tsv ? > > > > >> 2) Can I achieve this in pl/sql script or do I need to write > > > > unix or > > > > >> perl script or some other programing language, please advise? > > > > > >> Thanks a lot, > > > > >> John > > > > > I have a couple of thoughts on this > > > > > 1) I don't normally think of a TSV file as being an Excel file > > > > except in > > > > the sense that Excel can read and write it. > > > > > 2)you dont need PL/SQL to do this. My unix is a bit rusty so > > > > someone can > > > > correct me but wouldnt something like the following work from the > > unix > > > > command line? > > > > > sqlplus < foo.sql >>fooresults.tsv > > > > > Where foo.sql had something like > > > > > select A||chr(9)||B||chr(9)||C from foo; > > > > > plus appropriate login credentials ? > > > > > also note that I probably didnt create a proper TSV file but I > > > > think that > > > > can be left as an exercise (^I is a tab isnt it?)- Hide quoted text > > > > - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---