Running a query from a called form programmatically

Hi,
I would like to run a query from a called form using the same criteria as the calling form used, this is my situation;
I have a form with a field called IDNO when I execute the query I have code in the KEY-EXEQRY that first checks the HOLDER table to see if the IDNO exists if it does, the query will continue as normal and the record will be shown in the form, if it does not exist I have to query another table called DISTRIBUTOR which also has a field called IDNO. I would this to happen without any intervention from the user, in other words the the code that I have will call the second form and must execute the query. This is what I have so far in the KEY-EXEQRY.
*************************************************************************8
IF :holder.idno IS NOT NULL THEN
DECLARE
v_holder_idno xrays.holder.idno%type;
v_distr_idno xrays.holder.idno%type;
CURSOR holder_idno_cursor IS
SELECT idno
FROM holder
WHERE idno LIKE :holder.idno
ORDER BY idno;
CURSOR distr_idno_cursor IS
SELECT idno
FROM distr
WHERE idno LIKE :holder.idno
ORDER BY idno;
BEGIN
OPEN holder_idno_cursor;
FETCH holder_idno_cursor INTO v_holder_idno;
CLOSE holder_idno_cursor;
IF v_holder_idno IS NULL THEN
OPEN distr_idno_cursor;
FETCH distr_idno_cursor INTO v_distr_idno;
CLOSE distr_idno_cursor;
IF v_distr_idno IS NOT NULL THEN
CALL_FORM('X_DISTRIBUTOR_FORM');
/* This is where I need to populate the idno of the called form and execute the query and when the program gets back to the calling form the calling form should be in normal mode not query */
END IF;     
END IF;     
END;
END IF;
execute_query;
*************************************************************************************8
can anyone help me with this problem?
Thank you
Michael

Note something else...
If the above document is not applicable to 9i then you can find many...many articles if you write on the 'search' utility of OTN 'integrate reports and forms ' .
Simon

Similar Messages

  • How to run a report from oracle 10g form in .csv format

    dear all,
    how to run a report from oracle 10g form in .csv format? i've already run in pdf & excel format.
    i'm using
    SET_REPORT_OBJECT_PROPERTY (ro_report_id, report_desformat, 'PDF'); --for pdf
    SET_REPORT_OBJECT_PROPERTY (ro_report_id, report_desformat, 'SPREADSHEET'); ---for excel
    Please Help..

    i have already tried.
    but the report show in htm or html format. that file will not save into csv. please help.

  • Run BW query from R/3, need output file saved on application server

    Hello all,
    We are currently working on BI 7.0. Is there a way where we can run a BW query from R/3 by some program or tcode? We need to run the BW query and use the output of that query as an input to some other custom program in R/3.
    If we can save the output file on application server than the R/3 program will pick up that file from there.
    Is there any standard delivered functionality that will allow us to do that or how can we achieve this.
    Can some help help with some suggestions or links?
    Thanks in advance.

    Hi,
       Refer the following threads:
    [Calling BW Query from R/3;
    [Saving Bex Report / query in BW App server;
    Regards.

  • Show the print dialog when running a report from an Oracle form.

    I would like to be able to print an Oracle report from an Oracle form but
    in addition show the print dialog. My PL/SQL code is shown at the bottom of this post.
    I have set the 'printjob' system parameter to 'YES' in the
    report and I can bring up a print dialog using the reports runtime.
    However, as soon as I run it from my form I lose this capability. Setting
    'printjob' to 'YES' in the code has no apparent effect.
    Many thanks,
    Ben
    -- Launch a report
    DECLARE
      v_pl_Id   paramlist; -- parameter list
    BEGIN
      -- add the parameters to the list.
      v_pl_id := CREATE_PARAMETER_LIST ('summary');
      ADD_PARAMETER (v_pl_id, 'destype', text_parameter, 'PRINTER');
      ADD_PARAMETER (v_pl_id, 'printjob', text_parameter, 'YES');
      -- run the report
      RUN_PRODUCT (
        reports
      , 'C:\Test Reports\Test.rep'
      , synchronous
      , runtime
      , filesystem
      , v_pl_id
      , NULL
    END;

    At 10g not 9i using a bean area on my canvas implementing the following class ...
    import java.awt.Frame;
    import java.awt.JobAttributes;
    import java.awt.PrintJob;
    import java.awt.Toolkit;
    import javax.swing.JPanel;
    import java.io.*;
    import oracle.forms.ui.VBean;
    public class Select_Printer extends VBean {
    public Select_Printer()
         super();
    public String getPrinterName()
    String PrinterName=null;
              JobAttributes jobAttributes;
              try{
                   jobAttributes = new JobAttributes();
                   jobAttributes.setDialog(JobAttributes.DialogType.NATIVE);
                   Frame dummyFrame = new Frame();
                   PrintJob pJobDialog = Toolkit.getDefaultToolkit().getPrintJob(
                   dummyFrame, "Printtest", jobAttributes, null);
                   PrinterName = jobAttributes.getPrinter();
              } catch (Exception e) {
                   System.out.println("Printer error!");
              return PrinterName;
    public static void main(String[] args)
    Select_Printer select_Printer = new Select_Printer();
    System.out.println(select_Printer.getPrinterName() );
    }

  • Running mysqldump query from java code

    Hello,
    I m making a program I want to take a backup of database on a click of a button for which i want to execute this query :
    "mysqldump --user=root --password=root --opt dbname>c:\backup.sql"
    and my code is :
    String command = "cmd /c start";
    String[] env = new String[]{"mysqldump","--user=root", "--password=root",
    "--opt", "njitsurvey", "<", "c:\\backup_db.sql" };
    File dir = new File("C:/Program Files/MySQL/MySQL Server 5.0/bin/");
    Process p1 = Runtime.getRuntime().exec(command, env, dir);
    My problem is my command is running and going in to the directory also but not running my query and i m not getting and error also
    Edited by: purva on Aug 7, 2008 11:56 PM

    You need to print the content of the process error stream ( p1.getErrorStream() ) . It would also be worth you while reading http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .
    Also, you seem to think that setting the working directory toFile dir = new File("C:/Program Files/MySQL/MySQL Server 5.0/bin/");makes this the directory from which 'mysqldum' is found. It is not. The directory containing the executable has to on the PATH. The working directory is where the process looks for and creates data files if the full path to the files is not provided.
    Edited by: sabre150 on Aug 8, 2008 10:41 AM
    Also, you seem to think that the 'env' is the command executed! It is not. It the set of environment variables. You need to put the whole of the command as the first argument.
    Edited by: sabre150 on Aug 8, 2008 10:46 AM

  • How to run select query from one SID to fetch record from another SID?

    I have two SID, one is AAA and another is BBB and the connection name is A1 and B1 respectively. I want to run one select query from A1 connection to fetch record B1. Can anyone help me how I can connect from one SID to another SID?

    Hi 869357,
    You can also use the copy command. (Works with limited types)
    try:
    help copyRegards,
    Turloch

  • Urgent - Cannot run sub query from VB 6

    Hello!
    I'm having a problem with my Oracle OLE DB connection in windows using Visual Basic 6.0 SP3.
    I can run normal queries just fine, but a correlated sub query like this:
    select A.col_a, (select col_b from Tab_B where id = A.id) from Tab_A A
    returns the following error:
    "ORA-00907: missing right parenthesis"
    But I'm able to run the query witout errors in Toad with the correct result!
    So basically, I cannot run a (correlated?) sub query via OLE DB...
    What am I doing wrong?? Is it a parameter that I need to set on the connection of command?
    I'm not using stored procedures, only plain text SQL.
    Very thankful for a quick answer, this is really urgent. If you have the possibility, please e-mail me at:
    [email protected]
    Thank you in advance.
    Best regards,
    Bnar Baban

    Hi!
    I'm running the latest version of Oracle OLE DB...when checking more in detail, it seems that the provider parses the code in a way, that makes the "(select" part of the sub statement be interpreted as a column name....when it does not find a right parenthesis, but a white space, it complains.
    I switched to Microsoft MSDAORA provider, and now it works perfectly...
    /Bnar

  • Error in running custom query from jspx(site) for Content Tracker Report

    Hi All,
    I want to generate a custom Content Tracker Report. I am able to do so from Content Tracker console, but when i try to invoke the service 'SCT_GET_DOCUMENT_INFO_ADMIN' or 'SCT_GET_DOCUMENT_INFO' with my custom query(which simply counts the number of rows in a table) from my jspx page, it gives the following error.
    oracle.stellent.wcm.server.request.RequestException: Error
    occurred in Content Server executing service
    'SCT_GET_DOCUMENT_INFO_ADMIN'
    Caused By: oracle.stellent.ridc.protocol.ServiceException: Unable to get
    document info. Unable to execute service method 'sctExecuteQuery'. The
    error was caused by an internally generated issue. The error has been
    logged.
    What could be the reason and the resolution?
    Also, I know that i am invoking the service in the right way as custom report from query as 'select * from users' works fine from site.
    P.S. I am using UCM 11g + SSXA

    Things are turning weird. The below two queries work from jspx.
    1. SELECT * FROM Users
    2. SELECT dname FROM Users
    But, the following query gives error (SQL is correct).
    select dname, count(dname) from users group by dname
    Unable to execute service method 'sctExecuteQuery'. Null pointer is dereferenced.
    $Unable to get document info.!csUnableToExecMethod,sctExecuteQuery!syNullPointerException
    intradoc.common.ServiceException: !$Unable to get document info.!csUnableToExecMethod,sctExecuteQuery
    *ScriptStack SCT_GET_DOCUMENT_INFO_ADMIN
    3:sctExecuteQuery,**no captured values**
    at intradoc.server.ServiceRequestImplementor.buildServiceException(ServiceRequestImplementor.java:2115)
    at intradoc.server.Service.buildServiceException(Service.java:2260)
    at intradoc.server.Service.createServiceExceptionEx(Service.java:2254)
    at intradoc.server.Service.createServiceException(Service.java:2249)
    at intradoc.server.Service.doCodeEx(Service.java:584)
    at intradoc.server.Service.doCode(Service.java:505)
    at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1643)
    at intradoc.server.Service.doAction(Service.java:477)
    at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1458)
    at intradoc.server.Service.doActions(Service.java:472)
    at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1391)
    at intradoc.server.Service.executeActions(Service.java:458)
    at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:737)
    at intradoc.server.Service.doRequest(Service.java:1890)
    at intradoc.server.ServiceManager.processCommand(ServiceManager.java:435)
    at intradoc.server.IdcServerThread.processRequest(IdcServerThread.java:265)
    at intradoc.server.IdcServerThread.run(IdcServerThread.java:160)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
    Caused by: java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
    at intradoc.util.IdcConcurrentHashMap.get(IdcConcurrentHashMap.java:60)
    This works fine from Content Tracker UI.
    Anyone has any idea, what could be the issue here?

  • Error while running the query from WebI

    A database error occured. The database error test is: The MDX query Select Company code Vendor Fiscal year Cumulative Balance on Rows from 0FIAP failed to execute with the error See RFC trace file or SAP system log for more details. (WIS 10901)
    Any idea why I am getting this error??
    Thank you,
    Raju

    Hi Raju,
    This is a very generic error and occurs in various situation.
    You face this problem with all reports or only one specific report?
    If it is with one report then check to see if you are using proper calculation and formula.
    Check uinverse and parse all conditions.
    If this is happening with all the rerports then check your SP and FP.
    Regards,
    Bashir Awan

  • How to open new form and exit from the calling form on dual/multi language?

    using form 10g 10.1.2.0.2.
    i have dual language application 1 english & 1 arabic and i created forms identically each respectedly to call and switch every forms when user choose any language it uses.
    say im in currently in english. how we can call the arabic module and exit totally in english module , vice versa?
    also the form system messages. how we can switch it between two language?

    NEW_FORM() will totally replace the calling module.
    Francois

  • How to Automate the Query Search Upon Return to the Calling Form?

    Greetings Ya’ll Gurus,
    Could you please share with me how to make the Query Search executed automatically each time, when database table is updated, upon return to the “Calling Form” (i.e. FormA in this posting) from the “Called Form” (i.e. FormB from here on)?
    I have FormA call_form to FormB. FormB may return to FormA. FormA allows users to enter the Query parameters and perform query Search to the database table with a list of search results afterward; whereas FormB allows users to add or delete the same database table records. Both form images are as follows:
    FormA:
    !http://dot.state.ak.us/nreg/jtomasic/FormA_DWR_SEL.GIF!
    FormA call_form to FormB by clicking PB “Daily Work Report” (see circled PB "Daily Work Report" in the above image.)
    FormB Image (FormB allows users to add and delete database records):
    !http://dot.state.ak.us/nreg/jtomasic/FormB_DWR.GIF!
    FormB EXIT_FORM and returns to FormA (see circled PB "DWR Selection" in above image).
    Currently, our users must press the PB “Search” on FormA each time to refresh the Query “Search” results after returning to FormA, and they request to have the "Search" done automatically/programmatically upon return to FormA each time when the database table is updated.
    If you have programming code on this and are willing to share or if you have any suggestion or thoughts on this, it would be most greatly appreciated.
    Thanks a lot & Happy Holidays!

    Thanks so much Andreas, and yes, your link for calling a form and passing a context is very helpful. I believe, your suggested use of the global variable for the saved database table will work for the automation of the Query Search. I am, however, not sure how to make the code and the trigger to automatically perform Query PB "Search". The code for our current "WHEN-BUTTON-PRESSED" Trigger for the PB-Search of FormA is as following:
    DECLARE
         alert_button     NUMBER;
         alert_id               ALERT;
      MY_WHERE VARCHAR2(2500);
      MY_DIST_ID         DIST.DIST_ID%TYPE     := :BLK_UPDATE.DIST_ID;
      MY_ORG_ID          DWR.ORG_ID%TYPE       := :BLK_UPDATE.ORG_ID;
      MY_ACTY_ID         DWR.ACTY_ID%TYPE      := :BLK_UPDATE.ACTY_ID;
      MY_ACTY_WORK_ID    DWR.ACTY_WORK_ID%TYPE := :BLK_UPDATE.ACTY_WORK_ID;
      MY_CNTY_ID         DWR.CNTY_ID%TYPE      := :BLK_UPDATE.CNTY_ID;
      MY_ASSET_GRP_ID    DWR.ASSET_GRP_ID%TYPE := :BLK_UPDATE.ASSET_GRP_ID;
      MY_ASSET_ID        DWR.ASSET_ID%TYPE     := :BLK_UPDATE.ASSET_ID;
      MY_RTE             DWR.RTE%TYPE          := :BLK_UPDATE.RTE;
      MY_BEG_MP          DWR.BEG_MP%TYPE       := :BLK_UPDATE.BEG_MP;
      MY_END_MP          DWR.END_MP%TYPE       := :BLK_UPDATE.END_MP;
      MY_FROM_DATE       DWR.DWR_DATE%TYPE     := :BLK_CONTROL.FROM_DATE;
      MY_TO_DATE         DWR.DWR_DATE%TYPE     := :BLK_CONTROL.TO_DATE;
      MY_FLAG_OFFSYS     VARCHAR2(11)          := :BLK_UPDATE.FLAG_OFFSYS;
      MY_FLAG_COMMENTS   VARCHAR2(11)          := :BLK_UPDATE.FLAG_COMMENTS;
      MY_SPECIAL_EVENT_SEQ_NO SPECIAL_EVENT.SPECIAL_EVENT_SEQ_NO%TYPE  := :BLK_UPDATE.SPECIAL_EVENT_DESCR;
      MY_FLAG_ACCDT      VARCHAR2(11)          := :BLK_UPDATE.FLAG_ACCDT;
    BEGIN
    :blk_control.dummy_flag := 1 ;
    :BLK_CONTROL.DUMMY_ERR_FLAG := 'N';
    VALIDATION_SELECTION;     -- Program Unit VALIDATES DWR SELECTION PARAMETERS PRIOR TO
                                                    -- PERFORMING THE SEARCH AND POPULATING THE DISPLAY BLOCK
    if :blk_control.dummy_flag = 1 then
      IF :BLK_CONTROL.DUMMY_ERR_FLAG = 'N' THEN
        MY_WHERE := BUILD_WHERE_CLAUSE(MY_DIST_ID,
                                       MY_ORG_ID,
                                       MY_ACTY_ID,
                                       MY_ACTY_WORK_ID,
                                       MY_CNTY_ID,
                                       MY_ASSET_GRP_ID,
                                       MY_ASSET_ID,
                                       MY_RTE,
                                       MY_BEG_MP,
                                       MY_END_MP,
                                       MY_FROM_DATE,
                                       MY_TO_DATE,
                                       MY_FLAG_OFFSYS,
                                       MY_SPECIAL_EVENT_SEQ_NO,
                                       MY_FLAG_ACCDT,
                                       MY_FLAG_COMMENTS);
        SET_BLOCK_PROPERTY('BLK_DISPLAY', DEFAULT_WHERE, MY_WHERE);
        GO_BLOCK('BLK_DISPLAY');
        CLEAR_BLOCK(NO_VALIDATE);
        EXECUTE_QUERY(ALL_RECORDS);
        IF :BLK_DISPLAY.DWR_SEQ_NO IS NOT NULL THEN
                   SET_ITEM_ON_OR_OFF('BLK_CONTROL.PB_PRINT', TRUE);
        ELSE
                   SET_ITEM_ON_OR_OFF('BLK_CONTROL.PB_PRINT', FALSE);
                   alert_id := FIND_ALERT('no_data_query');
                   IF ID_NULL(alert_id) THEN
                        error_msg(1000);
                   ELSE
                        set_alert_message(alert_id, 1040);
                        alert_button := SHOW_ALERT(alert_id);
                   END IF;
              END IF;
              GO_BLOCK('BLK_UPDATE');
              GO_ITEM('BLK_CONTROL.PB_SEARCH');
         END IF;
    end if;
    END;My questions are:
    After initializing, set and/or reset the global variable for the saved database table,
    do I copy the above code (i.e. the "entire" code in the "WHEN-BUTTON-PRESSED" Trigger for the PB-Search) to the WHEN-NEW-FORM-INSTANCE-trigger, or other trigger(s), of FormA to automate the Query Search whenever there is a successful database commit/save? Or
    is there a simple way to activate the code in the "WHEN-BUTTON-PRESSED" Trigger for the PB-Search of FormA? Or
    is there a simple way to activate the EXECUTE_QUERY(ALL_RECORDS) command in the WHEN-NEW-FORM-INSTANCE-trigger or other trigger(s) of FormA ?
    Thanks and always.

  • No response when running Query from client

    Hey.
    I have a problem, I have installed Oracle9i on a Red Hat 9 Professional server, I have made my database, and have also put in some data, now here is the problem.
    When i connect and run a query from my server, then it runs fine and fast, If i run the same query from min Winxp workstation, then my SQLPlus just hangs.
    I can from my workstation ping and tnsping my server without any problems. and as far as i can see my tnsnames og listener is working fine.
    hope u can help
    /regards
    Jonas Skjoldan

    We did have a bug in older versions of smartview where it was not possible to deinstall it. Smartview was removed but any attempt to install a new version failed. This was because Smartview creates a Registry entry in:
    HKEY_CURRENT_USER\Software\Microsoft\Installer
    and adds the key
    C:\DOCUME~1\USERNAME\LOCALS~1\Temp\_is3EA\
    which then prevents any newer version of SmartView to be installed
    I looked on my machine and the is3EA file does not exist, however there is an installer file called isA.exe
    The registry entries for smartview are found under HKEY_CURRENT_USER\Software\Hyperion Solutions\Hyperion Smartview - maybe you could try deleting these entries? --> solution works.
    Edited by: user9378541 on 27-sep-2010 2:45

  • Code to run a query in SQL from Access with pass through query

    I have a query in SQL Server 2008:
     [Auto Null Up Date].sql. I want to run this query from Access 2007 using a Pass Through Query. What is the command/code to run this query from Access? I have used Pass Through Queries but never in this capacity so I am somewhat lost. I have
    already established the OBDC link and tested.

    Naomi,
    Here are a few lines of the SQLCMD code in the [Auto Null Update].sql query:
    USE [Archive Master]
    Go
    :r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null BackPress 2 update.sql"
    GO
    :r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null CHWR 3 update.sql"
    GO
    :r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null CHWR 4 update.sql"
    When this code is pasted into a Create Procedure, (the USE [Archive Master] is not used), the procedure will run, but once saved here is what is left of the procedure once I attempt to modify:
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author:                         
    <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description:              
    <Description,,>
    -- =============================================
    Create PROCEDURE [dbo].[NullTest2]
    AS

  • How do you call a single block in a form from a different form ?

    Hello All,
    I'm trying to call a particular block in a form. The actual call is done via fnd_function.execute. This brings up 2 blocks:
    1) a find/search block
    2) the block I want with the correct information based on the parameters I have passed in.
    Everything so far is OK with the exception of not wanting the 'find' block to appear. I've tried to hide the associated window by using the hide_window function but this doesn't work. Anyone got any new ideas I can try ?
    Thanks in advance
    Sandy

    If you have both blocks on the same canvas they will both appear if you navigate to a field in either block.
    So, put each block on its own canvas. When you navigate to a field in one block only that block will appear.
    As far as navigating to a block from another form there is not built-in function to do that. You can only call and entire form from another form. You could however pass a parameter from the calling form to the called form. On the when-new-form-instance of the called form check for the parameter value and go_item('myblock.myitem') which will display the block you want.
    Message was edited by:
    Mark Reichman

  • Calling a module component from a diff form

    Hi guys,
    Does any one know how to:
    call a module component of a form from a nother from using call form procedure or any diff method.
    Thanks

    Hello,
    Open the on-line help of the Forms Builder : Ctrl+H
    click the Index tab, enter CALL_FORM then click : Calling Modal Forms with CALL_FORM then the OPEN button.
    You can find the example you search.
    Francois

Maybe you are looking for