Run_product in DB procedure?

Reg : Executing an OS command in PL/SQL.
I used host command in form level procedure to
send all the .txt files into a master file(eg master.txt)
From master.txt, i read the flat file names and upload the datas
into Oracle (by using Text_Io package). But same thing, when i
used in db procedure with UTL_FILE
package , I can not proceed with the host command whereas it
works in sqlplus prompt. Is it possible to give host command in
db procedure or any other suggestions ?
2) A process is running at the back end with every 20
minutes interval of time using dbms_job.submit.
can I flash a message to any of the terminal/server/session
after successful completion
or if error occured?
3) can I call run_product in db procedure?
Thanking in advance,
expecting yr reply soon
regards
Radha krishnan
null

Hallo
Radhakrishnan
i dont know how to do it
Syam
S.Radha Krishnan (guest) wrote:
: Reg : Executing an OS command in PL/SQL.
: I used host command in form level procedure to
: send all the .txt files into a master file(eg master.txt)
: From master.txt, i read the flat file names and upload the
datas
: into Oracle (by using Text_Io package). But same thing, when i
: used in db procedure with UTL_FILE
: package , I can not proceed with the host command whereas it
: works in sqlplus prompt. Is it possible to give host command
in
: db procedure or any other suggestions ?
: 2) A process is running at the back end with every 20
: minutes interval of time using dbms_job.submit.
: can I flash a message to any of the terminal/server/session
: after successful completion
: or if error occured?
: 3) can I call run_product in db procedure?
: Thanking in advance,
: expecting yr reply soon
: regards
: Radha krishnan
null

Similar Messages

  • Problem in Integrating Oracle Forms10g and Graphics 6i

    Hi , everybody..
    I have Installed Oracle Developer Suite 10g and Oracle Graphics 6i on the same machine , in seperate directories , of course.
    I have done all the necessary modifications of the file default.env - concerning this type of integration.
    The problem is that when I press a button which calls the graphic , the system runs the Oracle Graphics Batch successfully and it is supposed to insert the graphic in a chart item in a form - but it doesn't-, the message 'FRM-41211 Integration error: SSL failure running another product' appears.
    I have tried all the possible combinations of parameters of RUN_PRODUCT built-in procedure ('synchronous/asynchronous' , 'batch/runtime') but the same problem insists!!!
    What may be the problem?
    Sould I install the JRE of Developer 6i in the same ORACLE path i installed the Oracle Graphics 6i , or simply the JDK of it?
    Simon...

    Simon,
    a search on meta link unveiled a couple of notes and bugs that all deal with this message. My recommendation is to contact customer support for a proper analysiz of the problem.
    Frank

  • Scheduling Multiple Reports at Once

    Is it possible to schedule multiple reports at once - so if I have a set of 40 reports that make up a financial close book, can I just schedule the book?
    Thanks,
    Chris

    Hi ,
    use the RUN_PRODUCT() built - in procedure..... for every instance of record , if you have a multi-record-block.....
    note: maybe you should give some additional info , adout what the form like , in which circumstances should the reports be called , .. ... e.t.c..
    Simon

  • Reports 2.5: Portrait/ Landscape problem

    I am facing a problem when I print either Landscape or Portrait
    formats one after other. I am using the forms 4.5 to run reports
    with out dialogue box. When I change the 'ORIENTATION' the margin
    also changing, so part of the reports are not printed out.
    Can some one help me.
    Thanks.
    null

    hello MJS!
    If I never mistaken, you want to print a report
    using form by using run_product built-in procedures and
    using this procedures,you set PARAMFORM PARAMETER to
    FALSE that's why you didn't see the report parameter
    on runtime.And you didn't initialize the
    ORIENTATION parameter on this procedure that's
    why your orientation is default or depend on
    printer setup.
    If this is your case then I suggest this solution.
    a.)add this parameter on your parameter list
    Add_Parameter(pl_id,
    'Orientation',TEXT_PARAMETER,'landscape');
    b.)In Report Designer open your program then
    in SYSTEM PARAMETER you will find ORIENTATION as
    one of its parameter list.Check its properties then
    set INITIAL VALUE to LANDSCAPE;
    I hope this will help. GOOD LUCK!
    Dennis J.
    Senior System Analyst / Programmer
    NEC System Integrator & Const - JAPAN/MANILA
    null

  • RUN_PRODUCT is not working

    hI,
    I am working in developer 6i forms and reports. I am trying to call a report from a for using RUN_PRODUCT built in. But it’s generating the following
    Error: FRM-41211: Integration error: SSL failure running another product.
    I think the procedure used for running the report is ok because it’s working in another machine.
    Please help me, how can I solve this problem.
    Best Regards,

    Re-Install the reports again,,
    this is a common Windows Problem

  • RUN_PRODUCT (Forms/Reports Upgrade)

    Hello,
    I have an Oracle Forms application.
    The total application is about 44 forms and 7 reports developed under Oracle Forms/Reports 6i.
    This is running in a Client/Server 2-tier model.
    I want to upgrade to the Web with Oracle 9i Database and Application Server.
    My forms use the RUN_PRODUCT modem to call Reports.
    1) Do I need to rewrite my PL/SQL code to change the RUN_PRODUCT to RUN_REPORT_OBJECT ?
    Regards,
    PT

    Paolo,
    FMA does only perform required code changes. The run_product to run_report_object conversion requires you to provide values for the Reports Server name and the access path you use on your system. Further more the migration will set a default Reports output. if you want your application to programmatically control this, you will have to add code that sets the Reports format and the destination type. The added rp2rrp.pll library has procedures for this.
    The compiler in Oracle Application Server can be used, but doesn't help if you hit a migration issue that wasn't handled by FMA. I would recommend to use the Oracle Developer Suite for migration.
    Frank
    Frank

  • RUN_PRODUCT in forms10g

    we are migrating our forms from 6i to 10g and are locked with an issue where one of the custom forms is calling a report from the form. Its using the RUN_PRODUCT.
    CODE in 6i
    PROCEDURE RUN_REPORT IS
    pl_id Paramlist;
    begin
    pl_id:=GET_PARAMETER_LIST('pl_report');
         IF NOT id_null (pl_id) THEN
              DESTROY_PARAMETER_LIST(PL_ID);
         END IF;
    PL_ID :=CREATE_PARAMETER_LIST('pl_report');
    add_parameter(pl_id, 'paramform',text_parameter, 'yes');
    ADD_PARAMETER(pl_id, 'C_cont_NUMBER_I', text_parameter, :cont.cont_number_i);
    ADD_PARAMETER(pl_id, 'J_cont_NUMBER_I', text_parameter, :cont.cont_number_i);
    ADD_PARAMETER(pl_id, 'M_cont_NUMBER_I', text_parameter, :cont.cont_number_i);
    Run_Product(REPORTS,'X:\ABC\PWAVCONT.rep',SYNCHRONOUS,runtime,FILESYSTEM, PL_ID);
    END;
    CODE in 10g (after conversion by the tool)
    Code modified by the Forms Migration Assistant
    30-Apr-2010 11:28 AM
    PROCEDURE RUN_REPORT IS
    pl_id Paramlist;
    a report_object;
    v_rep varchar2(100);
    begin
    pl_id:=GET_PARAMETER_LIST('pl_report');
    IF NOT id_null (pl_id) THEN
    DESTROY_PARAMETER_LIST(PL_ID);
    END IF;
    PL_ID :=CREATE_PARAMETER_LIST('pl_report');
    add_parameter(pl_id, 'paramform',text_parameter, 'yes');
    ADD_PARAMETER(pl_id, 'C_cont_NUMBER_I', text_parameter, :cont.cont_number_i);
    ADD_PARAMETER(pl_id, 'J_cont_NUMBER_I', text_parameter, :cont.cont_number_i);
    ADD_PARAMETER(pl_id, 'M_cont_NUMBER_I', text_parameter, :cont.cont_number_i);
    RP2RRO.RP2RRO_RUN_PRODUCT(REPORTS,'X:\ABC\PWAVCONT.rep',SYNCHRONOUS,runtime,FILESYSTEM, PL_ID,null);
    END;
    Though after converting the form with migration assistant, the code for calling the report has been changed by the tool automatically. still the form compilation fails
    Failed with below error
    Compiling procedure RUN_REPORT...
    Compilation error on procedure RUN_REPORT:
    PL/SQL ERROR 201 at line 20, column 1
    identifier 'RP2RRO.RP2RRO_RUN_PRODUCT' must be declared
    PL/SQL ERROR 0 at line 20, column 1
    Statement ignored
    Please suggest any solution here.

    Neil,
    After you submit the report, you have to check the status using Report_Object_Status built-in. If the return value is "FINISHED", you can then display the finished report to the user using the Web.Show_Document built-in. Here's how we do it:
    PROCEDURE RUN_REPORT (P_paramlist  paramlist) IS
       v_report         REPORT_OBJECT;
       v_rep_rtn   VARCHAR2(4000);
       rep_status   VARCHAR2(4000);
       v_hostname   VARCHAR2 (500);
       v_repsvrname  VARCHAR2 (100) := 'YOUR SERVER NAME HERE';
       v_paramtype  NUMBER;
    BEGIN
       -- Assign any parameters first.
       Get_Parameter_Attr(p_paramlist, 'P_REPSERVER', v_paramtype, v_repsvrname);
       v_report := Find_Report_Object('REPORT_NAME_HERE');
       Set_Report_Object_Property(v_report, report_execution_mode, batch);
       Set_Report_Object_Property(v_report, report_comm_mode, synchronous);
       Set_Report_Object_Property(v_report, report_destype, CACHE);
          /* Make sure to set the format correctly - we always used PDF so we hardcoded it. */
       Set_Report_Object_Property(v_report, report_desformat, 'pdf'); 
       Set_Report_Object_Property(v_report, report_server, v_repsvrname);
       -- Run the Report
       v_rep_rtn := Run_Report_Object(v_report, p_paramlist);
       -- Get the Report Status
       rep_status := Report_Object_Status(v_rep_trn);
       WHILE ( rep_status IN ('RUNNING','OPENING_REPORT','ENQUEUED') ) LOOP
          rep_status := Report_Object_Status(v_rep_trn);
       END LOOP;
       IF ( rep_status <> 'FINISHED' ) THEN
          Clear_Message;
          Message('Error running report.  Status = '||rep_status);
          Message(' ');
       ELSE
          Web.Show_Document('/reports/rwservlet/getjobid'||substr(v_rep_trn, INSTR(v_rep_rtn,'_',-1) +1)
                ||'?server='||v_repsvrname);
       END IF;
    END;We created this procedure and stored it in a Library and attached the library to every form. You may have to tweek it a bit to make it work for you.
    Hope this helps,
    Craig
    If a response is helpful or correct, please mark it accordingly.

  • Calling Oracle Reports from stored procedures

    Hi ,
    Can anybody tell me whether this is possible and if so, how it can be done. Thanks for your help.
    Regards,
    Deepa

    Oracle Forms allows you to easily integrate Oracle Reports into your
    applications. However, on the Macintosh, it is not possible to use
    the normal Oracle Reports runtime to generate ASCII text files. In
    order to allow ASCII text files to be generated with Oracle Reports
    on the Macintosh, the Reports<TEXT> Runtime applications was
    developed. This version of the runtime only allows you to generate
    text files and should not be used for other purposes.
    While the Reports<TEXT> Runtime application has been provided, there
    is no built in integration with Forms. This bulletin explains a
    method which you can use integrate these two applications with little
    effort. In order to use this method, you will need the following
    items installed on your computer:
    * Oracle Forms 4.0
    * Oracle Reports 2.0
    * Oracle Command 1.0
    * AppleScript 1.1. This is available as part of the Macintosh
    Operating System version 7.5 as well as with certain 3rd party
    applications.
    Because the only way to use the Reports<TEXT> Runtime application is
    through Oracle Command, we will be using Oracle Command to run the
    Reports<TEXT> Runtime application. However, we need some way to
    communicate with Oracle Command which report we would like to run and
    what parameters we would like to pass in to Reports. To accomplish
    this goal, an AppleScript application will be used. Forms can use
    AppleEvents (Apple's method for inter-application communication) to
    communicate with this AppleScript application which can then create
    an Oracle Command script file to run. So, the summary of events
    which will take place are as follows:
    1. Forms dynamically creates a command line to run the
    Reports<TEXT> Runtime application.
    2. Using AppleEvents, Forms communicates this command line to the
    AppleScript application which writes out an Oracle Command
    script file.
    3. The AppleScript application communicates with Oracle Command and
    tells it to run the script which it just created.
    4. Oracle Command runs the script which invokes the Reports<TEXT>
    Runtime application.
    1. Creating the AppleScript Application
    The core of this solution is the AppleScript Application. While it
    is not necessary for you to be familiar with AppleScript, it will
    help tremendously in your understanding of how everything works.
    Here we provide you with an AppleScript which provides the
    functionality we need to implement our procedure.
    Note: This AppleScript is designed to work with the Macintosh
    Operating System version 7.5. It should work with earlier
    versions of the Operating System, but no guarantees are
    made. Furthermore, there are known problems with the version
    of AppleScript provided with version 7.1.2 of the Operating
    System which will cause your machine to crash when this
    script is executed. These problems with AppleScript were
    corrected for the version 7.5 release of the Operating System.
    -- This AppleScript Application is responsible for being a
    -- "go-between" between Oracle Forms and Oracle Command. It is
    -- responsible for both dynamically creating Oracle Command script
    -- files and disposing of these files.
    -- NOTE: This AppleScript Application was written for the Macintosh
    -- Operating System version 7.5. It has not been tested
    -- on any other version of the Macintosh Operating
    -- System.
    -- Author
    -- ======
    -- Doug Bitting
    -- Oracle Worldwide Technical Support
    -- Apple Desktop Products Group
    -- Date: 21-MAR-95
    -- The syntax "on <<...>> args" is how you setup an AppleScript to
    -- accept AppleEvents.
    -- Be careful, the << and >> characters are option-\ and option-|
    -- respectively. They are not two less-than signs and two
    -- greater-than signs.
    on <<event R20Trunt>> cmdScript
    -- First, let's construct a, hopefully, unique file name
    set dt to ((current date) as string)
    set hr to (word 5 of dt)
    set mn to (word 6 of dt)
    set sec to (word 7 of dt)
    set fName to (hr * 3600 + mn * 60 + sec as string)
    -- For this example, we will put all dynamically constructed
    -- script files onto the desktop.
    set tFold to (path to desktop)
    set fName to (tFold & "tmp." & fName as string)
    -- set up a mnemonic for the Return character
    set cr to (ASCII character 13)
    try
    -- open our Oracle Command script file
    -- The sequence <opt-l> at the end of the following line
    -- should be type in as an option-l (that is, a lowercase L).
    set fRef to (open for access file fName with write <opt-l>
    permission)
    -- Now, write the Oracle Command command line which was
    -- passed to us via AppleEvents.
    -- The sequence <opt-l> at the end of the following line
    -- should be type in as an option-l (that is, a lowercase L).
    write (cmdScript & cr) starting at <opt-l>
    ((get eof fRef) + 1) to fRef
    -- Now we have to also ask Oracle Command to let us know
    -- when it is finished with the script file we are
    -- creating. Basically, we are asking Oracle Command to
    -- use AppleEvents to let us know when to throw away the
    -- file we are creating
    -- The sequence <opt-l> at the end of the following lines
    -- should be type in as an option-l (that is, a lowercase L).
    write ("host SENDAE aplt R20T remv ---- t \"" & fName <opt-l>
    & "\";" as string) starting at <opt-l>
    ((get eof fRef) + 1) to fRef
    -- close the Oracle Command script file
    close access fRef
    -- Now that we have setup the temporary file,
    -- tell Oracle Command to execute it.
    tell application "Oracle Command 1.0"
    runscript fName
    end tell
    -- You can put some error handling here if you'd like.
    end try
    end <<event R20Trunt>>
    -- This is the AppleEvent handler to clean up when we are done. It
    -- simply throws the temp file into the trash can.
    -- Be careful, the << and >> characters are option-\ and option-|
    -- respectively. They are not two less-than signs and two
    -- greater-than signs.
    on <<event R20Tremv>> fName
    tell application "Finder"
    move (fName as alias) to (path to trash)
    end tell
    end <<event R20Tremv>>
    2. Setting Up Forms
    It is useful to setup a PL/SQL Program Unit to hide the details
    behind running the Text Runtime. Here is a suggested PL/SQL Program
    Unit for you to use:
    -- The following procedure is used to hide some of the details in
    -- using the AppleScript Application. It accepts 4 arguments:
    -- * The report name
    -- * The name of the output file
    -- * The parameters you would like to pass in. These need to be
    -- formatted just as if you were calling reports from a
    -- command line.
    -- * A connect string for Reports<TEXT> Runtime to connect with.
    procedure run_text_report (
    rName in char,
    oName in char,
    params in char,
    cString in char) is
    cLine varchar2(1000);
    begin
    cLine := 'execute r20text module='&#0124; &#0124;rname;
    cLine := cLine &#0124; &#0124; ' userid='&#0124; &#0124;cString;
    cLine := cLine &#0124; &#0124; ' paramform=no batch=yes';
    cLine := cLine &#0124; &#0124; ' destype=file desname='&#0124; &#0124;oname;
    cLine := cLine &#0124; &#0124; ' desformat=dflt.prt '&#0124; &#0124;params&#0124; &#0124;';';
    host('SENDAE aplt R20T runt ---- t "'&#0124; &#0124;cLine&#0124; &#0124;'"');
    -- NOTE: in the above host() command, the series of quotes at the
    -- end reads as follows: double-quote, single-quote, vertical
    -- bar, vertical bar, the word cLine, vertical bar, vertical
    -- bar, single-quote, double-quote, single-quote.
    end;
    Here is an example of how I can use the above procedure. In a
    WHEN-BUTTON-PRESSED trigger, I might have:
    declare
    reportName varchar2(16);
    outputName varchar2(64);
    paramVals varchar2(64);
    connectStr varchar2(16);
    begin
    -- We want to run the report named "myreport". The output from this
    -- report should go into a file named "output.txt" located in the
    -- "Reports" directory on my hard drive. This report accepts two
    -- parameters: p_start_date and p_end_date. The connect string for
    -- the database I am using is simply "scott/tiger"
    -- Setup some variables to hold all the information I want to pass
    -- in to run_text_report(). This information is put into variables
    -- for readability.
    reportName := 'myreport';
    outputName := 'HD:Reports:output.txt';
    paramVals := 'p_start_date=''01-MAR-95'' p_end_date=''31-MAR-95''';
    connectStr := 'scott/tiger';
    -- Run the report
    run_text_report(reportName, outputName, paramVals, connectStr);
    end;
    3. Putting the pieces together
    In order for this solution to function, you need to make sure that
    both your AppleScript application and Oracle Command are running when
    you make a call to run_text_report(). It is possible for you to
    launch Oracle Command from within Oracle Forms with the following
    line of code:
    host('LAUNCHID oBTL');
    If you place the above line of code in a WHEN-NEW-FORM trigger, you
    can assure that Oracle Command will be running when your form is
    launched.
    It is also possible for you to have Oracle Forms launch your
    AppleScript application. However, in order for you to do this, you
    need to be very familiar with the Macintosh Operating System, how to
    change the creator type of a file, and know what effects that change
    can produce. If you do not know how to change the creator type of
    your AppleScript application or are not comfortable doing so, you
    should simply document that your users need to make sure to launch
    your AppleScript application before trying to use your Form.
    However, if you know how to change the creator type of your
    AppleScript application and are comfortable doing so, here are the
    steps you will need to take to have Oracle Forms launch your
    AppleScript application for you:
    * Change the creator type of your AppleScript application to
    something unique.
    * Modify the run_text_report() procedure. You need to change the
    four character sequence "aplt" found in the host() command to the
    new creator type of your AppleScript application.
    * Add the line host('LAUNCHID <your new creator type>'); to your
    WHEN-NEW-FORM trigger or to whichever trigger you placed the
    host('LAUNCHID oBTL'); statement.
    There is one significant difference between RUN_PRODUCT and this
    solution. With RUN_PRODUCT, you have the option of specifying
    whether or not the call should be synchronous or asynchronous.
    However, the call to run_text_report() will always be asynchronous.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Deepa Pai:
    Hi ,
    Can anybody tell me whether this is possible and if so, how it can be done. Thanks for your help.
    Regards,
    Deepa <HR></BLOCKQUOTE>
    null

  • Running procedure in forms

    Hi, i have a procedure that populates a temporary table. After populating, i have several functions that run to compute values based on the records on the temporary table and then deletes the records upon form exit. Now, what i want to do is just run the procedure to populate the temporary table and then display the data on the table. But when i tried running just the procedure, nothing happens. I cant see the data on the table. How can i do this please? Thank you. Here is the query in my forms developer:
    DECLARE
    plid paramlist;
    the_param varchar2(1600) := 'tmpdata';
    it_id Item;
    V_RI_BUSY CHAR(1);
    BEGIN
    if :block3.date_to is null then
    message('no date to');
    message('no date to');
    Go_Item(':block3.date_to');
    end if;
    /* check if 'tmpdata' exists */
    plid := get_parameter_list(the_param);
    /* if it does exist, destroy it */
    if not id_null(plid) then
    destroy_parameter_list(plid);
    end if;
    /* create it fresh */
    plid := create_parameter_list(the_param);
    add_parameter(plid,'PARAMFORM', TEXT_PARAMETER, 'NO');
    add_parameter(plid,'V_CUTOFF_FROM',TEXT_PARAMETER,TO_CHAR(:BLOCK3.DATE_FROM,'DD/MON/YYYY'));
    add_parameter(plid,'V_CUTOFF_TO',TEXT_PARAMETER,TO_CHAR(:BLOCK3.DATE_TO,'DD/MON/YYYY'));
    add_parameter(plid,'P_CLASSIFICATION',TEXT_PARAMETER,:BLOCK3.RADIO_GROUP_TRANS_SUBTRANS);
    add_parameter(plid,'P_GRID',TEXT_PARAMETER,:BLOCK3.GRID);
    add_parameter(plid,'P_REGION',TEXT_PARAMETER,:BLOCK3.REGION);
    add_parameter(plid,'P_DISTRICT',TEXT_PARAMETER,:BLOCK3.DISTRICT);
    add_parameter(plid,'P_BRANCH',TEXT_PARAMETER,:BLOCK3.BRANCH);
    add_parameter(plid,'P_USER_NAME',TEXT_PARAMETER,:global.v_user_name);
    add_parameter(plid,'P_POSITION',TEXT_PARAMETER,:global.v_position);
    CALC_DATA_2010(:BLOCK3.DATE_FROM,
    :BLOCK3.DATE_TO,
    :BLOCK3.GRID,
    :BLOCK3.REGION,
    :BLOCK3.DISTRICT,
    :BLOCK3.BRANCH);
    run_product(REPORTS,'RPTSPM_NOI_DETAILS.rep',
    SYNCHRONOUS,RUNTIME,
    FILESYSTEM,
    plid);
    END;

    Thanks. Actually, the original query was working fine - when some values were computed thru functions based from data on the temporary table. But when i removed the functions and just run the procedure, i could not display the records in the temp table. Here below is the working query (some parts were removed in the middle to shorten it):
    DECLARE
         V_RI_BUSY CHAR(1);
    BEGIN
              CALC_DATA_2010(:BLOCK3.DATE_FROM,
                   :BLOCK3.DATE_TO,
                   :BLOCK3.GRID,
                   :BLOCK3.REGION,
                   :BLOCK3.DISTRICT,
                   :BLOCK3.BRANCH);
              IF :BLOCK3.DATE_FROM IS NOT NULL AND :BLOCK3.DATE_TO IS NOT NULL THEN
              --MESSAGE('Computing....');
              IF :RADIO_GROUP_TRANS_SUBTRANS = 'TS' THEN
                   MESSAGE('TRANS-SUBTRANS: Finished....');
                   :DO_VALID.TEXT_LINE_TYPE:= 'RELIABILITY INDICATORS (Trans-Subtrans)';
              ELSIF :RADIO_GROUP_TRANS_SUBTRANS = 'T' THEN
                   MESSAGE('TRANS: Finished....');
                   :DO_VALID.TEXT_LINE_TYPE:= 'RELIABILITY INDICATORS (Trans)';
              ELSE
                   MESSAGE('SUBTRANS: Finished....');
                   :DO_VALID.TEXT_LINE_TYPE:= 'RELIABILITY INDICATORS (Subtrans)';
              END IF;
              IF :BLOCK3.RADIO_GROUP_TRANS_SUBTRANS = 'T' THEN
                   :DO_VALID.TEXT_LINE_TYPE:= :DO_VALID.TEXT_LINE_TYPE||'- 1 MIN. ';
              ELSE
                   :DO_VALID.TEXT_LINE_TYPE:= :DO_VALID.TEXT_LINE_TYPE||'- 5 MINS. ';
              END IF;
    -- COMPUTE RELIABILITY INDICATOR
    -- GO_BLOCK('DO_VALID');
                        GO_ITEM('DO_VALID.INT_N001');
                        IF :RADIO_GROUP_TRANS_SUBTRANS = 'TS' THEN
                                  CALC_INT(' ');
                             CALC_SAIDI_SAIFI_maifi_TS(' ');                                   CALC_SISI(' ');
                                  CALC_TLF_TS;
                        ELSIF :RADIO_GROUP_TRANS_SUBTRANS = 'T' THEN
                                  CALC_INT('T');
                                  CALC_SAIDI_SAIFI_maifi('T');
                                  CALC_SISI('T');
                        -- THIS IS SAME AS TRANS-SUBTRANS
                                  CALC_TLF_TS;
                        ELSE
                             CALC_INT('S');
                        CALC_SAIDI_SAIFI_maifi('S');
                                  CALC_SISI('S');
                                  CALC_TLF_S;
                        END IF;
              ELSE
              MESSAGE('DATE RANGE MUST BE SPECIFIED.');
              IF      :BLOCK3.DATE_FROM IS NULL THEN
                   GO_ITEM('BLOCK3.DATE_FROM');
              ELSE
              GO_ITEM('BLOCK3.DATE_TO');
              END IF;
              END IF;
    END;
    The above query works fine as it is. Procedure CALC_DATA_2010 populates the temp table then several functions (CALC_INT, CALC_SISI, etc.) runs to compute several values based on data from temp table. CALC_DATA_2010 query is shown below:
    CREATE OR REPLACE PROCEDURE SPM_IS.CALC_DATA_2010(
    date_from IN date,
    date_to IN date,
    text_GRID IN VARCHAR,
    text_REGION in varchar,
    text_DISTRICT in varchar,
    text_branch in varchar
    IS
    CURSOR TRIP_CLASS IS
    SELECT DISTINCT TRIP_CAUSED_BY, SCODE_TRIP_CAUSED_BY
    FROM SPM_REL_IND_TMP
    WHERE TRIP_CAUSED_BY IS NOT NULL;
    CURSOR Cas IS
    SELECT substr(customer_code,6,4) customer_code, demand, period
    FROM SPM_ACTUAL_SALES
    WHERE to_date(to_char(PERIOD,'MM/RRRR'),'MM/RRRR')
    BETWEEN TO_DATE(TO_CHAR(Date_From,'MM/RRRR'),'MM/RRRR') AND
    TO_DATE(TO_CHAR(Date_To,'MM/RRRR'),'MM/RRRR');
    v_cuscode spm_daily_outs.substation_code%TYPE;
    v_demand spm_actual_sales.demand%TYPE;
    v_period spm_actual_sales.period%TYPE;
    V_OUT_DATE spm_daily_outs.out_date%TYPE;
    BEGIN
    DELETE FROM SPM_REL_IND_TMP;
    commit;
    INSERT INTO spm_rel_ind_tmp(branch_code, ccode,circuit, scode, UE, outage_type,OUTAGE_CODE,OUTAGE_SUBCODE, V_OUT_DATE, V_DATE_IN,cload,
    frequency, classification, trip_caused_by, TRIP_CAUSED_TLTX, scode_trip_caused_by, interruption_event,
    remarks,DISCONNECT_SWITCH,DURATION)
    (SELECT z.branch_code, z.circuit_code, z.circuit, z.substation_code,
    (CASE WHEN ROUND(Z.UE,2) <> ROUND((Z.PEAK_DEMAND*Z.DURATION2*1000/60),2)
    THEN
    ROUND(Z.ue ,2)
    ELSE
    (CASE WHEN Z.DURATION = Z.DURATION2
    THEN
    ROUND(Z.ue ,2)
    ELSE
    (CASE WHEN Z.UE < (Z.PEAK_DEMAND*Z.DURATION*1000/60)
    THEN
    ROUND(Z.ue ,2)
    ELSE
    ROUND((Z.PEAK_DEMAND*Z.DURATION*1000/60),2)
    END)
    END)
    END) UE,
    z.outage_type, Z.OUTAGE_CODE,Z.OUTAGE_SUBCODE,z.V_OUT_DATE, z.V_DATE_IN,
    z.connected_load, z.frequency, z.classification, z.trip_caused_by, z.TRIP_CAUSED_TLTX, z.scode_trip_caused_by, z.interruption_event,
    z.remarks,z.DISCONNECT_SWITCH,z.duration
    from
    SELECT y.branch_code, y.circuit_code, y.circuit, y.substation_code, y.peak_demand, y.outage_type,Y.OUTAGE_CODE,Y.OUTAGE_SUBCODE, y.V_OUT_DATE, y.V_DATE_IN,
    y.connected_load, y.frequency, y.classification, y.trip_caused_by, Y.TRIP_CAUSED_TLTX, y.scode_trip_caused_by, y.interruption_event,
    y.remarks,y.DISCONNECT_SWITCH,
    (CASE WHEN Y.DATE_PRIVATELY_OWNED IS NULL THEN
    (CASE WHEN (Y.ESTIMATE IS NULL and Y.V_DATE_IN IS NOT NULL)
    THEN
    (DECODE(SIGN(Y.V_OUT_DATE - DATE_FROM),
    -1,DECODE(SIGN(Y.V_DATE_IN - DATE_TO),
    -1, Y.V_DATE_IN - DATE_FROM, -- DATE_TO > date_in & date_out < TO_DATE(DATE_FROM, 'DD/MON/YYYY')
    +1, (DATE_TO - DATE_FROM)+1, -- Date_in > DATE_TO & date_out < TO_DATE(DATE_FROM, 'DD/MON/YYYY')
    END) END)
    *24*60 DURATION, ((V_DATE_IN -V_OUT_DATE)*24*60) DURATION2, UE
    FROM
    (SELECT B.BRANCH_CODE, b.circuit_code, B.DATE_PRIVATELY_OWNED,b.circuit, b.substation_code, b.peak_demand, b.outage_type,B.OUTAGE_CODE,B.OUTAGE_SUBCODE, b.V_OUT_DATE, b.V_DATE_IN,
    b.connected_load, b.frequency, b.classification, b.trip_caused_by,B.TRIP_CAUSED_TLTX,b.scode_trip_caused_by,
    b.interruption_event, b.remarks,b.DISCONNECT_SWITCH, b.estimate, b.ue
    FROM (SELECT X.BRANCH_CODE, d.circuit_code, C.DATE_PRIVATELY_OWNED,d.circuit, d.substation_code, d.peak_demand, d.outage_type,
    D.OUTAGE_CODE_NEW OUTAGE_CODE,D.OUTAGE_SUBCODE_NEW OUTAGE_SUBCODE, D.V_OUT_DATE, d.V_DATE_IN,
    D.connected_load, d.frequency, c.classification, d.trip_caused_by, D.TRIP_CAUSED_TLTX,d.scode_trip_caused_by,
    d.interruption_event, d.remarks,d.DISCONNECT_SWITCH, d.estimate, unserved_energy ue
    FROM spm_daily_outs d, SPM_SUBSTATIONS X,
    spm_circuits c
    WHERE
    X.SUBSTATION_CODE = D.SUBSTATION_CODE
    AND (C.DATE_PRIVATELY_OWNED IS NULL OR (C.DATE_PRIVATELY_OWNED > TO_DATE(DATE_FROM, 'DD/MON/YYYY')
    AND C.DATE_PRIVATELY_OWNED <= TO_DATE(DATE_TO, 'DD/MON/YYYY'))
    and ((D.V_OUT_DATE >= (TO_DATE(TO_CHAR(Date_From,'DD-MON-RRRR'),'DD-MON-RRRR HH24:MI:SS')) and
    D.V_OUT_DATE <= TO_DATE(TO_CHAR(Date_To ,'DD-MON-RRRR')||' 23:59:59','DD-MON-RRRR HH24:MI:SS')
    OR
    ((D.V_OUT_DATE <= (TO_DATE(TO_CHAR(Date_From,'DD-MON-RRRR'),'DD-MON-RRRR HH24:MI:SS'))) AND
    D.V_DATE_IN >= (TO_DATE(TO_CHAR(Date_From,'DD-MON-RRRR'),'DD-MON-RRRR HH24:MI:SS'))
    ) and (SUBSTR(d.circuit_code,5,1) = '4' OR SUBSTR(d.circuit_code,5,1) = '8')
    AND d.OUTAGE_CODE_NEW NOT IN (SELECT OUTAGE_CODE FROM SPM_TL_OUTAGE_CLASS_2010)
    AND (D.OUTAGE_SUBCODE_NEW NOT IN (SELECT OUTAGE_SUBCODE FROM SPM_TL_OUTAGE_SUB_2010)
    OR LENGTH(LTRIM(RTRIM(D.OUTAGE_SUBCODE_new))) IS NULL
    and d.circuit_code = c.circuit_code
    and d.substation_code = c.substation_code
    AND (SUBSTR(D.SUBSTATION_CODE, 1,1)=TEXT_GRID OR TEXT_GRID IS NULL)
    AND (SUBSTR(D.SUBSTATION_CODE, 2,4)=TEXT_REGION OR TEXT_REGION IS NULL)
    AND (SUBSTR(D.SUBSTATION_CODE, 6,4)=TEXT_DISTRICT OR TEXT_DISTRICT IS NULL)
    AND (D.CIRCUIT_CODE IN (SELECT CIRCUIT_CODE FROM SPM_CIRCUITS WHERE BRANCH_CODE = TEXT_BRANCH)
    OR TEXT_BRANCH IS NULL)
    ) b
    ) y
    ) z);
    COMMIT;
    DELETE FROM spm_tmp_actual_sales;
    commit;
    FOR dem_record IN Cas LOOP
    EXIT WHEN Cas%NOTFOUND;
    INSERT INTO spm_tmp_actual_sales(customer_code, demand, period)
    VALUES(dem_record.customer_code,dem_record.demand,dem_record.period);
    END LOOP;
    FOR TRIP IN TRIP_CLASS LOOP
    EXIT WHEN TRIP_CLASS%NOTFOUND;
    UPDATE SPM_REL_IND_TMP
    SET CLASSIFICATION_TRIP = (SELECT CLASSIFICATION
    FROM SPM_CIRCUITS
    WHERE RTRIM(TRIP.TRIP_CAUSED_BY) = RTRIM(CIRCUIT_CODE)
    AND TRIP.SCODE_TRIP_CAUSED_BY = SUBSTATION_CODE)
    WHERE RTRIM(TRIP_CAUSED_BY) = RTRIM(TRIP.TRIP_CAUSED_BY)
    AND SCODE_TRIP_CAUSED_BY = TRIP.SCODE_TRIP_CAUSED_BY
    AND TRIP_CAUSED_TLTX = 'TL';
    UPDATE SPM_REL_IND_TMP
    SET TRIP_BRANCH_CODE = (SELECT BRANCH_CODE
    FROM SPM_CIRCUITS
    WHERE RTRIM(TRIP.TRIP_CAUSED_BY) = RTRIM(CIRCUIT_CODE)
    AND TRIP.SCODE_TRIP_CAUSED_BY = SUBSTATION_CODE)
    WHERE RTRIM(TRIP_CAUSED_BY) = RTRIM(TRIP.TRIP_CAUSED_BY)
    AND SCODE_TRIP_CAUSED_BY = TRIP.SCODE_TRIP_CAUSED_BY
    AND TRIP_CAUSED_TLTX = 'TL'
    UPDATE SPM_REL_IND_TMP
    SET CLASSIFICATION_TRIP =
    (SELECT distinct CLASSIFICATION
    FROM SPM_TRANSFORMERS
    WHERE RTRIM(TRIP.TRIP_CAUSED_BY) = RTRIM(TRANS_CODE)
    AND TRIP.SCODE_TRIP_CAUSED_BY = SUBSTATION_CODE
    AND CLASSIFICATION IN ( 'T', 'S')
    WHERE RTRIM(TRIP_CAUSED_BY) = RTRIM(TRIP.TRIP_CAUSED_BY)
    AND SCODE_TRIP_CAUSED_BY = TRIP.SCODE_TRIP_CAUSED_BY
    AND TRIP_CAUSED_TLTX = 'TX';
    UPDATE SPM_REL_IND_TMP
    SET TRIP_BRANCH_CODE = (SELECT BRANCH_CODE
    FROM SPM_SUBSTATIONS
    WHERE SUBSTATION_CODE = TRIP.SCODE_TRIP_CAUSED_BY
    WHERE CLASSIFICATION IN ( 'T', 'S')
    AND RTRIM(TRIP_CAUSED_BY) = RTRIM(TRIP.TRIP_CAUSED_BY)
    AND SCODE_TRIP_CAUSED_BY = TRIP.SCODE_TRIP_CAUSED_BY
    AND TRIP_CAUSED_TLTX = 'TX';
    END LOOP;
    commit;
    COMMIT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    RAISE;
    END;
    However, when i changed my query so that i will just get the data from the temporary table instead i was not successful. here is my revised query:
    DECLARE
    V_RI_BUSY CHAR(1);
    BEGIN
    CALC_DATA_2010(:BLOCK3.DATE_FROM,
                   :BLOCK3.DATE_TO,
                   :BLOCK3.GRID,
                   :BLOCK3.REGION,
                   :BLOCK3.DISTRICT,
                   :BLOCK3.BRANCH);
              IF :RADIO_GROUP_TRANS_SUBTRANS = 'TS' THEN                     MESSAGE('TRANS-SUBTRANS: Finished....');
                   :DO_VALID.TEXT_LINE_TYPE:= 'RELIABILITY INDICATORS (Trans-Subtrans)';
              ELSIF :RADIO_GROUP_TRANS_SUBTRANS = 'T' THEN
              MESSAGE('TRANS: Finished....');
                   :DO_VALID.TEXT_LINE_TYPE:= 'RELIABILITY INDICATORS (Trans)';
              ELSE
              MESSAGE('SUBTRANS: Finished....');
                   :DO_VALID.TEXT_LINE_TYPE:= 'RELIABILITY INDICATORS (Subtrans)';
              END IF;
              IF :BLOCK3.RADIO_GROUP_TRANS_SUBTRANS = 'T' THEN
                   :DO_VALID.TEXT_LINE_TYPE:= :DO_VALID.TEXT_LINE_TYPE||'- 1 MIN. ';
              ELSE
                   :DO_VALID.TEXT_LINE_TYPE:= :DO_VALID.TEXT_LINE_TYPE||'- 5 MINS. ';
              END IF;
              IF :BLOCK3.DATE_FROM IS NULL THEN
                   GO_ITEM('BLOCK3.DATE_FROM');
              ELSE
              GO_ITEM('BLOCK3.DATE_TO');
              END IF;
              END IF;
    END;
    I hope you will not be confused. Thanks again.

  • Pricing procedure of free goods

    Could anyone please tell me the effect of pricing procedure in free godds?And what is the difference between pricing procedure in free goods(IMG->Sales and Distribution->Basic Funcions->Free Goods) and pricing procedure in pricing(IMG->Sales and Distribution->Basic Funcions->Pricing)

    Hi Wei Zhang,
    When there are more than 2 materials say material A which is of some price, and material B which is Free of cost, then the item category will be different for those. TAN for Mat A and TANN for materail B.
    Pricing is depends upon the customer pricing procedure and document pricing procedure along with the Sales Area.
    When there are free Goods, Again yu have two conditions
    1. Give 100 % discount on free goods.
    2. Or charge 0 value for that.
    This pricing procedure you can do in free goods priocing procedure.
    Hope this will help.
    Thanks,
    Raja

  • Can not select from data dictionary view from a procedure

    Hi,
    I wonder, which privilege is missing here:
    my schema has this roles and privs:
    GRANT CONNECT, RESOURCE TO cb ;
    GRANT CREATE SESSION TO cb ;
    GRANT SELECT_CATALOG_ROLE TO cb ;
    GRANT CREATE SYNONYM TO CB;
    GRANT CREATE VIEW TO CB;
    I create a procedure:
    create or replace procedure dd_test as
    begin
         dbms_output.enable(2000000);
         for r in (select table_name from sys.dba_tab_partitions     where owner = 'CB') loop
                   dbms_output.put_line(r.table_name);
         end loop;
    end;
    sho err
    4/38 PL/SQL: ORA-00942: table or view does not exist
    When I run the core statement form sql prompt, it works !
    so what privilege is missing here ???
    thanks for any hint, Lao De

    Hi,
    thanks for that reply, after doing that I can not select this DD-view from sql-prompt anymore (which I don't wonder ;-). Can you tell me, what idea you had behind that test ?
    I found another instance, where the procedure works and I will compare those privileges, but it's hard to sort out that complex structure of nested roles and sys_privs.
    How ever, I will update here, when I found the missing privilege.
    regards LaoDe

  • Unable to capture the parameter values from a PL/SQL procedure

    hi.
    i'm trying to capture the parameter values of a PL/SQL procedure by calling inside a anonymous block but i'm getting a "reference to uninitialized collection error" ORA-06531.
    Please help me regarding.
    i'm using following block for calling the procedure.
    declare
    err_cd varchar2(1000);
    err_txt VARCHAR2(5000);
    no_of_recs number;
    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
    cntr_var number:=0;
    begin
         rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
         dbms_output.put_line('The error is ' ||err_cd);
         dbms_output.put_line('The error is ' ||err_txt);
         dbms_output.put_line('The cntr is ' ||cntr_var);
         for incr in 1 .. OUT_SIGN_TAB.count
         loop
         cntr_var := cntr_var + 1 ;
    Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN_TAB(incr).txn_type||','||OUT_SIGN_TAB(incr).objid);
    end loop;
    end;
    Error is thrown on "for incr in 1 .. OUT_SIGN_TAB.count" this line
    Following is some related information.
    the 3rd parameter of the procedure is a out parameter. it is a type of a PL/SQL table (SEARCH_SIGN_TAB_TYPE) which is available in database as follows.
    TYPE "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
    TYPE "SEARCH_SIGN_TYPE" AS OBJECT
    (ref_no VARCHAR2(22),
    ciref_no VARCHAR2(352),
    ac_no VARCHAR2(22),
    txn_type VARCHAR2(301),
    objid VARCHAR2(1024))............

    We don't have your rt843pq procedure, but when commenting that line out, everything works:
    SQL> create TYPE "SEARCH_SIGN_TYPE" AS OBJECT
      2  (ref_no VARCHAR2(22),
      3  ciref_no VARCHAR2(352),
      4  ac_no VARCHAR2(22),
      5  txn_type VARCHAR2(301),
      6  objid VARCHAR2(1024))
      7  /
    Type is aangemaakt.
    SQL> create type "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
      2  /
    Type is aangemaakt.
    SQL> declare
      2    err_cd varchar2(1000);
      3    err_txt VARCHAR2(5000);
      4    no_of_recs number;
      5    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
      6    cntr_var number:=0;
      7  begin
      8    -- rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
      9    dbms_output.put_line('The error is ' ||err_cd);
    10    dbms_output.put_line('The error is ' ||err_txt);
    11    dbms_output.put_line('The cntr is ' ||cntr_var);
    12    for incr in 1 .. OUT_SIGN_TAB.count
    13    loop
    14      cntr_var := cntr_var + 1 ;
    15      Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN
    TAB(incr).txntype||','||OUT_SIGN_TAB(incr).objid);
    16    end loop;
    17  end;
    18  /
    The error is
    The error is
    The cntr is 0
    PL/SQL-procedure is geslaagd.Regards,
    Rob.

  • Get Attribute values from a page and procedure exception handling?

    Hi All,
    I have created new page with two input attributes not based on any VO. This page is created to capture two values and pass these to an AM method upon pressing OK button. The method in AM will call a procedure with two in parameter expecting the two values captured from the above said page.
    I have two questions, first one how to capture the values entered by the page in the controller class and advises me how to handle exceptions when my procedure fails.
    I can not use something like this since this page is not based on a VO
    String fromName = (String)vo.getCurrentRow().getAttribute("FromName");
    Do I have to create a dummy VO like select '' name1, '' name2 from dual?
    Thanks for the help.

    Hi,
    Actually you can capture the parameters on the page like this way
    String test = (String)pageContext.getParameter("id of the text input bean");
    Now in procedure you can take an out parameter which stores the error messages on exception
    and return that out parameter in java.
    and then you can throw exception on page using OAException class.
    Thanks
    Gaurav Sharma

  • Get variable values from a stored procedure

    I am using SQL 2008R2 and I want to replace a view inside a stored procedure with a new stored procedure to return multiple variable values. Currently I am using the code below to get values for 4 different variables.  I would rather get the 4 variables
    from a stored procedure (which returns all of these 4 values and more) but not sure how to do so.  Below is the code for getting the 4 variable values in my current sp.
    DECLARE @TotalCarb real;
    DECLARE @TotalPro real;
    DECLARE @TotalFat real;
    DECLARE @TotalLiquid real;
    SELECT @TotalCarb = ISNULL(TotCarb,0),
    @TotalPro = ISNULL(TotPro,0),
    @TotalFat = ISNULL(TotFat,0),
    @TotalLiquid = ISNULL(TotLiq,0)
    FROM dbo.vw_ActualFoodTotals
    WHERE (MealID = @MealID);

    You can replace the view with inline table valued user-defined function:
    http://www.sqlusa.com/bestpractices/training/scripts/userdefinedfunction/
    See example: SQL create  INLINE table-valued function like a parametrized view
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Pointbase : How can I create a stored procedure with Pointbase database?

    Hello,
    Excuse me for my english, I'm not anglophone. I try to create a stored procedure.
    This is my file SampleExternalMethods.java :
      import java.sql.*;    //import com.pointbase.jdbc.jdbcInOutDoubleWrapper;          public class SampleExternalMethods    {      // A connection object to allow database callback      static Connection conn = null;      static Statement l_stmt;      static Statement m_stmt;      static CallableStatement m_callStmt = null;      static ResultSet l_rs = null;          public static void main(String[] args)      {        try        {          String url = "jdbc:pointbase:server://localhost/pointbaseDB";          String username = "PBPUBLIC";          String password = "PBPUBLIC";          conn = DriverManager.getConnection(url, username, password);          doCreateProcedure();          doInvokeProcedure();        } catch (SQLException e) {          e.printStackTrace();        } finally {          if (m_stmt != null) {            try {              m_stmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (m_callStmt != null) {            try {              m_callStmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (conn != null) {            try {              conn.close();            } catch (Exception e) {              e.printStackTrace();            }          }        }      }                  public static void getCountry(String Iso_Code)      {        try        {          // Query the database for the country iso code          l_stmt = conn.createStatement();          l_rs = l_stmt.executeQuery( "SELECT * FROM countries"          + " WHERE country_iso_code ='" + Iso_Code + "'");          //Affichage du résultat de la requête          l_rs.next();          System.out.print(l_rs.getString(1) + " - ");          System.out.print(l_rs.getString(2) + " - ");          System.out.println(l_rs.getString(3));          // Close the result set          l_rs.close();        } catch (SQLException e) {          e.printStackTrace();        } finally {          if (l_rs != null) {            try {              l_rs.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (l_stmt != null) {            try {              l_stmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }        }      }            public static void doCreateProcedure() throws SQLException {        // SQL statement to create a stored procedure        String SQL_CREATE_PROC = "CREATE PROCEDURE getCountry(IN P1 VARCHAR(30))"        + " LANGUAGE JAVA"        + " SPECIFIC getCountry"        + " NO SQL"        + " EXTERNAL NAME \"SampleExternalMethods::getCountry\""        + " PARAMETER STYLE SQL";        // Create a SQL statement        m_stmt = conn.createStatement();        // Execute the SQL        m_stmt.executeUpdate(SQL_CREATE_PROC);        // Close the statement        //m_stmt.close();      }          public static void doInvokeProcedure() throws SQLException {        // Create SQL to invoke stored procedures        String SQL_USE_PROC = "{ call getCountry(?) }";        // Create a callable statement with three binding parameters        m_callStmt = conn.prepareCall(SQL_USE_PROC);        m_callStmt.setString(1, "CA");        m_callStmt.executeQuery();        // Close the callable statement        //m_callStmt.close();      }    } 
    Afterwards, I have read this note in a Pointbase document:
    To invoke the dateConvert external Java method from a stored function, you must use the
    CREATE FUNCTION statement. The dateConvert external Java method is called from the
    class, SampleExternalMethods.
    In order for the database to access this external Java method, the class SampleExternalMethods
    must be included in the database CLASSPATH. For PointBase Embedded - Server Option, it
    must be in the Server CLASSPATH, but not in the Client CLASSPATH.
    If PointBase Server is run with the Java Security Manager, in the java policy file grant
    ’com.pointbase.sp.spPermission’ to the class that implements the external Java method.
    An "spPermission" consists of a class name with no action. The class name is a name of a class
    that could be used in creating a Stored Procedure in PointBase. The naming convention follows
    the hierarchical property naming convention and that is supported by
    "java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded
    by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
    contain any white spaces.
    I'm not sure, but I suppose that I must include the class SampleExternalMethods in a .jar file.
    The database CLASSPATH could be : C:\Sun\AppServer\pointbase\lib\
    These my files in this database CLASSPATH:
    pbclient.jar
    pbembedded.jar
    pbtools.jar
    pbupgrade.jar
    I have tryed to include the class SampleExternalMethods in pbclient.jar and pbembedded.jar with this command:
    jar -uf pbembedded.jar SampleExternalMethods
    Afterwards I do that,
    1) Start Pointbase
    2) Configuration of classpath
    set classpath=C:\Sun\AppServer\pointbase\lib\pbclient.jar
    set classpath=%classpath%;D:\J2EE\Ch07Code\Ch07_06
    I precise that my file SampleExternalMethods is into D:\J2EE\Ch07Code\Ch07_06\Ch07.
    Then, I run the program:
    D:\J2EE\Ch07Code\Ch07_06>java -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver Ch07.SampleExternalMethods
    But I have an error message:
    Exception in thread "main" java.lang.NoClassDefFoundError: Ch07.SampleExternalMethods (wrong name: SampleExternalMethods)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.DefineClass(ClassLoader.java:539)
    The problem, I suppose, comes from that the class SampleExternalMethods
    must be included in the database CLASSPATH, but there is a pbserver.jar with pointbase normally, but I didn't find it. That's why I use pbembedded.jar or pbclient.jar in order to include the class SampleExternalMethods. May be I must start from C:\Sun\AppServer\pointbase\lib\ instead of D:\J2EE\Ch07Code\Ch07_06\Ch07?
    Please, can somebody helps me?
    Thank you in advance.
    cagou!

    jschell wrote:
    And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    >And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    >
    And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    Thank you for your response, I have done two classes:
    SampleExternalMethods.java:
    package Ch07;
    import java.sql.*;*
    *public class SampleExternalMethods*
    *public static void getCountry(String Iso_Code)*
    *// A connection object to allow database callback*
    *Connection l_conn = null;*
    *Statement l_stmt = null;*
    *ResultSet l_rs = null;*
    *try*
    *String url = "jdbc:pointbase:server://localhost/pointbaseDB";*
    *String username = "PBPUBLIC";*
    *String password = "PBPUBLIC";*
    *l_conn = DriverManager.getConnection(url, username, password);*
    *// Query the database for the country iso code*
    *l_stmt = l_conn.createStatement();*
    *l_rs = l_stmt.executeQuery( "SELECT* FROM PBPUBLIC.COUNTRIES"
    +" WHERE country_iso_code ='"+ Iso_Code +"'");+
    +//Affichage du r&eacute;sultat de la requ&ecirc;te+
    +l_rs.next();+
    +System.out.print(l_rs.getString(1)+ " - ");
    System.out.print(l_rs.getString(2) +" - ");+
    +System.out.println(l_rs.getString(3));+
    +// Close the result set+
    +l_rs.close();+
    +} catch (SQLException e) {+
    +e.printStackTrace();+
    +} finally {+
    +if (l_rs != null) {+
    +try {+
    +l_rs.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (l_stmt != null) {+
    +try {+
    +l_stmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (l_conn != null) {+
    +try {+
    +l_conn.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +}+
    +}+
    +}+
    CreateMethods.java:
    +package Ch07;+
    +import java.sql.*;+
    +public class CreateMethods+
    +{+
    +// A connection object to allow database callback+
    +static Connection m_conn = null;+
    +static Statement m_stmt;+
    +static CallableStatement m_callStmt = null;+
    +public static void main(String[] args)+
    +{+
    +try+
    +{+
    +String url = "jdbc:pointbase:server://localhost/pointbaseDB";+
    +String username = "PBPUBLIC";+
    +String password = "PBPUBLIC";+
    +m_conn = DriverManager.getConnection(url, username, password);+
    +doCreateProcedure();+
    +doInvokeProcedure();+
    +} catch (SQLException e) {+
    +e.printStackTrace();+
    +} finally {+
    +if (m_stmt != null) {+
    +try {+
    +m_stmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (m_callStmt != null) {+
    +try {+
    +m_callStmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (m_conn != null) {+
    +try {+
    +m_conn.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +}+
    +}+
    +public static void doCreateProcedure() throws SQLException {+
    +// SQL statement to create a stored procedure+
    +String SQL_CREATE_PROC = "CREATE PROCEDURE PBPUBLIC.getCountry(IN P1 VARCHAR(30))"+
    " LANGUAGE JAVA"
    +" SPECIFIC getCountry"+
    " NO SQL"
    +" EXTERNAL NAME \"SampleExternalMethods::getCountry\""+
    " PARAMETER STYLE SQL";
    // Create a SQL statement
    m_stmt = m_conn.createStatement();
    // Execute the SQL
    m_stmt.executeUpdate(SQL_CREATE_PROC);
    // Close the statement
    //m_stmt.close();
    public static void doInvokeProcedure() throws SQLException {
    // Create SQL to invoke stored procedures
    String SQL_USE_PROC = "{ call getCountry(?) }";
    // Create a callable statement with three binding parameters
    m_callStmt = m_conn.prepareCall(SQL_USE_PROC);
    m_callStmt.setString(2, "CA");
    m_callStmt.executeQuery();
    // Close the callable statement
    //m_callStmt.close();
    }But I have the same error message that previously.
    I have read this note and I suppose that the problem is linked:
    If PointBase Server is run with the Java Security Manager, in the java policy file grant
    *’com.pointbase.sp.spPermission’ to the class that implements the external Java method.*
    An "spPermission" consists of a class name with no action. The class name is a name of a class
    that could be used in creating a Stored Procedure in PointBase. The naming convention follows
    the hierarchical property naming convention and that is supported by
    *"java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded*
    by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
    contain any white spaces.
    Can you explain me what I must to do in order to solve this problem of spPermission.
    Thanks.

Maybe you are looking for

  • How to validate the incoming field value and raise an alert message

    Dear all, I have the following structure If incoming value for the field externalid is empty then i have to raise a alert message to end user "externalid field is empty for the id : id number" and for all incoming values it should work. I used the fo

  • HT4587 i want to plug my apple tv via ethernet to mac mini and wirelessly transmit data, movies to work in iMovie

    its in the heading if anyone can help thanks

  • POI/import issue

    Hi! Has anyone used the POI project? I'm trying to use the Excel sheet and have import org.apache.poi.hssf.usermodel.*;but this is generating a compilation error saying that package org.apache.poi.hssf.usermodel doesn't exist. I can do this: import c

  • How do I store documents iniCloud?

    Before iCloud, I could copy any document to iDisk and utilize it. How do you do this in iCloud? I have many PDF's still on iDisk. ? I know I can share docs using iWork and iLife, but what about MS Office or PDF's? I would love to have the same functi

  • Manual order number

    Hi , Which exit can be used to set the quotation number programmatically in a quotation. I have the following scenario when the user creates a quotation with reference to a quotation , say 300, the revised quotation number must be 300R1, where can i