Form blows up when clicked in data block using a FROM clause query

Hi,
I have a form that has two blocks. The detail block is based on a "FROM query clause" in the 'Query Data Source Type' in the block Properties.
I have a simple select in the 'Query Data Source Name'.
I made sure the select is enclosed in parenthesis and the alias names in the SELECT are the same as the ITEMS defined in the block
The data needs to be displayed in a tabular fashion.
When I run the form, the data is displayed correctly..but when I click the mouse on any item of this block or try to scroll down, everything just blows up and it closes my form.
I have made sure both blocks have the same properties. But, this seems to happen no matter what.
Any help in regard is greatly appreciated.
Thanks much,
Vijji

This is how I set the relationship for the detail block say BLOCK2.
1. I first do this:
Database Data Block = YES
Query Allowed = YES
Query Data Source Type = FROM clause query Query Data Source Name = ( select jio.order_header_id order_header_id, jii.item_code item_code, SUM(jii.item_qty) item_qty from joe_indv_items jii, joe_indv_orders jio where jii.indv_order_id = jio.indv_order_id group by jio.order_header_id, jii.item_code )
The master and detail need to be tied by the order_header_id which I can get from the header block.
2. In the WHEN-NEW_BLOCK-INSTANCE trigger for BLOCK2, I wrote the following where I dynamically pass the order_header_id:
DECLARE
q varchar2(1000);
BEGIN
     q := '(SELECT jio.order_header_id order_header_id,
     jii.item_code item_code,
     SUM(jii.item_qty) item_qty
     FROM joe_indv_items jii, joe_indv_orders jio
     WHERE jio.order_header_id = ' || :HEADERS.order_header_id||'
     AND jii.indv_order_id = jio.indv_order_id
     GROUP BY jio.order_header_id, jii.item_code )';
     CLEAR_BLOCK;
SET_BLOCK_PROPERTY('BLOCK1', QUERY_DATA_SOURCE_NAME, q);
EXECUTE_QUERY;
END;
I am not sure if I should write the exact select statement in the Query Data Source Name or not.
Please advice.
Thanks much,
Vijji

Similar Messages

  • Block based on from clause query

    Hi all...
    I am using forms 10g .....
    When I wanted block based on from clause query...
    I used this query ( SELECT * FROM exit INNER JOIN enter ON exit.ent_num = enter.ent_num where enter.depart=1)...
    When I run form .....
    frm-40505 oracle error unable to perform query
    Thank you
    Edited by: osa3_12 on Dec 10, 2009 4:33 AM

    hi
    try something like this.
      1* select empno,ename from emp where empno=empno order by 1
    SQL> /
         EMPNO ENAME
          7000 Sarah
          7369 SMITH
          7499 ALLEN
          7521 WARD
          7566 JONES
          7654 MARTIN
          7698 BLAKE
          7782 CLARK
          7788 SCOTT
          7839 KING
          7844 TURNER
         EMPNO ENAME
          7876 ADAMS
          7900 JAMES
          7902 FORD
          7934 MILLER
          8898 Sheela
    16 rows selected.
      1* select empno,ename from emp where empno=7000
    SQL> /
         EMPNO ENAME
          7000 Sarah
    SQL> sarah

  • Block based on "From clause query" and substitution variable

    Hi Folks,
    I have a "From clause query" block type, which is based on query that uses a substitution variable (:BLOCK.COLUMN) from previous block. When I run a query, then I obtain an error: ORA-01008: not all variables bound.
    My query looks like:
    select seq_no, prod_code, descr, curr_code,
           max(decode(sched_type_code,'ROLLOVER',amt,0)) OUTSTD_DRAW,
           max(decode(sched_type_code,'INTCHG',amt,decode(sched_type_code,'FEEREC',amt,0))) OUTSTD_INTEREST_FEE
    from
        select r.fac_no, r.prod_code, f.descr, r.prod_seq_no seq_no, r.curr_code, r.sched_type_code,sum(nvl(rep_amt,0)) amt
          from repay_scheds r,
               fac_prods f
         where r.fac_no = f.fac_no
           and r.prod_code = f.prd_code
           and r.prod_seq_no = f.seq_no
           and r.fac_no = :B2.FAC_NO
           and r.trans_ref_from is not null
           and r.status         <> 'P'
        group by r.fac_no, r.prod_code, f.descr, r.prod_seq_no, r.curr_code, r.sched_type_code 
    group by seq_no, prod_code, descr, curr_code
    having max(decode(sched_type_code,'ROLLOVER',amt,0)) >0 or max(decode(sched_type_code,'INTCHG',amt,decode(sched_type_code,'FEEREC',amt,0))) > 0Once I replace that substitution variable in query condition with some exact test number then it works fine.
    select seq_no, prod_code, descr, curr_code,
           max(decode(sched_type_code,'ROLLOVER',amt,0)) OUTSTD_DRAW,
           max(decode(sched_type_code,'INTCHG',amt,decode(sched_type_code,'FEEREC',amt,0))) OUTSTD_INTEREST_FEE
    from
        select r.fac_no, r.prod_code, f.descr, r.prod_seq_no seq_no, r.curr_code, r.sched_type_code,sum(nvl(rep_amt,0)) amt
          from repay_scheds r,
               fac_prods f
         where r.fac_no = f.fac_no
           and r.prod_code = f.prd_code
           and r.prod_seq_no = f.seq_no
           and r.fac_no = 2012500
           and r.trans_ref_from is not null
           and r.status         <> 'P'
        group by r.fac_no, r.prod_code, f.descr, r.prod_seq_no, r.curr_code, r.sched_type_code 
    group by seq_no, prod_code, descr, curr_code
    having max(decode(sched_type_code,'ROLLOVER',amt,0)) >0 or max(decode(sched_type_code,'INTCHG',amt,decode(sched_type_code,'FEEREC',amt,0))) > 0How can I use substitution variable within query for "From clause query" block type? Or any other way how to get the same result?
    Thanks for your reply.
    Tomas

    I have a solution:
    Before entering block I'm calling function, that populates my block:
    PROCEDURE POP_<<MY_BLOCK>>_BLOCK IS
      query_txt varchar2(2000);
    BEGIN
       query_txt := '(select seq_no, prod_code, descr, curr_code,
                            max(decode(sched_type_code,''ROLLOVER'',amt,0)) OUTSTD_DRAW,
                            max(decode(sched_type_code,''INTCHG'',amt,decode(sched_type_code,''FEEREC'',amt,0))) OUTSTD_INTEREST_FEE
                                                  from
                                                     select r.fac_no, r.prod_code, f.descr, r.prod_seq_no seq_no, r.curr_code, r.sched_type_code,sum(nvl(rep_amt,0)) amt
                                                       from repay_scheds r,
                                                            fac_prods f
                                                      where r.fac_no = f.fac_no
                                                        and r.prod_code = f.prd_code
                                                        and r.prod_seq_no = f.seq_no
                                                        and r.fac_no = '||:B2.FAC_NO||'
                                                        and r.trans_ref_from is not null
                                                        and r.status         <> ''P''
                                                     group by r.fac_no, r.prod_code, f.descr, r.prod_seq_no, r.curr_code, r.sched_type_code 
                                                 group by seq_no, prod_code, descr, curr_code
                                                 having max(decode(sched_type_code,''ROLLOVER'',amt,0)) >0 or max(decode(sched_type_code,''INTCHG'',amt,decode(sched_type_code,''FEEREC'',amt,0))) > 0)';
       Go_Block('<<MY_BLOCK>>' );
       Clear_Block ;
       Set_Block_Property( '<<MY_BLOCK>>', QUERY_DATA_SOURCE_NAME, query_txt) ;
       -- populate my  block --
       Execute_Query ;
    END;Thanks,
    Tomas

  • Using FROM clause query in block

    I have a block using a FROM clause query instead of a table. I have two items in the block that correspond to the select statement. Here's the SQL statement I've entered:
    SELECT BEZEICHNUNG, ZEIT_TYP_NR
    FROM ZEIT_TYPE
    WHERE ZEIT_TYP_NR IN
    (SELECT ZEIT_TYP_NR
    FROM PROM_ZEIT_TYP
    WHERE PROM_TYP_NR = :GLOBAL.PROM_TYP_NR)
    When I run forms, it ADDS to my SQL statement!! Here's what it does:
    SELECT BEZEICHNUNG,ZEIT_TYP_NR
    FROM (SELECT BEZEICHNUNG, ZEIT_TYP_NR FROM ZEIT_TYPE) WHERE ZEIT_TYP_NR IN
    (SELECT ZEIT_TYP_NR
    FROM PROM_ZEIT_TYP
    WHERE PROM_TYP_NR = :1)
    can anyone tell me why it's adding this first line to my select statement??

    "a from clause query" is the rather strange name forms uses for what is generally known as in an in-line view.
    Your in-line view is being treated by forms the same way as it would a table, it sticks a SELECT, a list of columns determined from the database items in the block and a FROM on the beginning. If the user specifies query criteria in enter-query mode it will quite correctly apply the where clause to the outer select rather than to the in-line view.

  • Oracle Forms - How can I create a Data Block with query

    Dear friends I have a question, I couldn't do this..
    I have a sql query, I want to show the datas of the query.. How can I do this. ?
    Data Block Wizard wants a table, view or stored procedure, but I have a query, how can I create a data block with my query.. I m waiting your helps..? Please...
    Semih

    Hi,
    You have two options
    1. create a view and base the block on the view
    2. create a block with a query Data Source Type of 'FROM clause query'
    Hope this helps
    Neil

  • FROM clause query dara block

    Hi,
    A data block which was created using FROM clause query, can be set as master block of another block? So i want to build a detail block and the master block being the 1st block, made with FROM clause query.
    Thanks

    i observed that a block created with FROM clause query cannot be a detail block, but it can be a master block. Correct?Yes, a From Clause based Block can be the master table in the Master - Detail relationship. I have successfully created a Form with this type of relationship! (I found my demo - I had it reversed).
    I tried to create a FROM clause data block as detail block (and set a relationship with a master block) but i encountered an error at the relation and i deleted it (also the automatically generated triggers).This was my experience when I attempted a demo form that had the From Clause based block as a Detail in the Master - Detail relationship. The error in the On-Populate-Details triggers was easily fixed (the query has to be wrapped in parenthesis) but when I ran the form there was no coordination between the blocks.
    but anyway, are these things written in the documentation?Not that I have ever found. It was always my understanding that if Oracle considered the data block to be a "base table block" (eg; block property Database Data Block = Yes) then all of the features of a base table block were available. The only thing I found in the documentation (Forms Help system - search on: "About creating a Master-Detail Relationship" and open the resulting document) indicated that a relationship should not be created where the detail block is based on a procedure, but it was OK if the master block was based on a procedure (see the Limitations section of the aforementioned document). I guess you could infer that this limitation applies to From Clause based blocks as well, but this is not explicitly stated in this document.
    Craig...

  • From Clause Query block

    I'm using a from clause query block.
    I'm being prompted to use a on-lock trigger, if I have to update an item in my said block.
    1.What is the purpose of on-lock trigger in the given scenario, can I just use a null in the trigger.
    2.Further, why is it necessary to set the database item property to yes for all items in a from clause query block?

    The nature of use of the said from clause query based form I have explained above is that it is used to primarily set a No_change_flag from the screen in different loan type tables.
    If the concerned user decides that a loan should not be modified, he will come to this screen and query for that loan type, and check the no_change_flag. Then from the when button pressed trigger we go and update that respective loan type table and set the no_change_flag to YES.
    We have 4 loan type tables.Some times the user might choose to query by loan_date , and that will return multiple loans belonging to multiple loan types. In such a scenario we update multiple loan tables wherein the loan
    should not be changed.
    Actually we loop through the block and if the no_change_flag is chekced to YES, and then we update that respective loan type table. Yes when we are looking and issuing updates, and before the commit_form is issued at the end of the loop, in between some other user tries to update the row locked for update by us, then they will automatically get the appropriate message.
    I dont see the need in the above case to code anything else than NULL;
    Do anyone see this in a different way, or I'm I missing any impact the above functionality might cause?

  • Insert in a "FROM clause query" block

    I have a block based on "FROM clause query" (querying two different tables). I want to be abble to insert in this block. I wrote the DML code to insert in both tables, but I then need to stop forms who try to insert by itself, because it fails and rollback my change. How can I do this ?

    If you have Oracle Server 8.1.6+ you can
    create a database view with these two tables
    and create a "instead of" trigger to insert
    in both tables. It will be faster to
    execute, your Forms becomes simpler and it
    is easier to manage. Example from the
    Oracle Server documentation :
    CREATE TABLE customers_sj
    ( cust NUMBER(6),
    address VARCHAR2(50),
    credit NUMBER(9,2) );
    CREATE TABLE customers_pa
    ( cust NUMBER(6),
    address VARCHAR2(50),
    credit NUMBER(9,2) );
    CREATE TYPE customer_t AS OBJECT
    ( cust NUMBER(6),
    address VARCHAR2(50),
    credit NUMBER(9,2),
    location VARCHAR2(20) );
    CREATE VIEW all_customers (cust)
    AS SELECT customer_t (cust, address, credit, 'SAN_JOSE')
    FROM customers_sj
    UNION ALL
    SELECT customer_t (cust, address, credit, 'PALO_ALTO')
    FROM customers_pa;
    CREATE TRIGGER instrig INSTEAD OF INSERT ON all_customers
    FOR EACH ROW
    BEGIN
    IF (:new.cust.location = 'SAN_JOSE') THEN
    INSERT INTO customers_sj
    VALUES (:new.cust.cust, :new.cust.address,:new.cust.credit);
    ELSE
    INSERT INTO customers_pa
    VALUES (:new.cust.cust, :new.cust.address, :new.cust.credit);
    END IF;
    END;
    null

  • FROM Clause query data source type

    i do i get the result set of a FROM Clause datasource into an item.

    A FROM clause may be used as the datasource for a data block. A FROM clause is a feature of the Oracle8 Server that allows you to nest a SELECT statement in the FROM clause of a SELECT statement. A FROM clause is a valid query block datasource, but it is not a valid DML block datasource. The value returned from a FROM clause is a subset of records from the original query.
    FROM clauses are used to perform joins, lookups, and calculations without having to create a view on the server. FROM clauses can also be used to prototype views and to increase performance.
    Using a FROM clause as a block datasource is similar to using an updateable join-view as a block datasource. However, a FROM clause provides more control, because the presence of a DBA is not required to define the view. You should note that the FROM clause produces results that are identical to an updateable join-view from the client side, but that there is no defined view on the server.
    My question has not been answere and i hope the above copies explanation from forms6i documentation will help understand the question better.
    Please Advise

  • SET_BLOCK_PROPERTY('QUERY_DATA_SOURCE_NAME') with FROM clause query data block

    Two block :
    - Block A based on table
    - Block B based on FROM clause query
    In WHEN-NEW-RECORD-INSTANCE of block A, I perform a SET_BLOCK_PROPERTY('BLOCK_B','QUERY_DATA_SOURCE_NAME','(...)'); and then query block B (... depends on value taken by 'code' column in block A).
    At runtime it works till 'code' does not change (query_data_source_name does not change) but when I navigate to a record having a different 'code', it got the folowing message :
    41380 - Cannot set the blocks query data source.
    Any idea or suggestion ?

    Hello all i m trying dynamically change query_data_source_name but its not working.
    i did the followings
    Forms(10g2) block level:Query_data_source_type
    Query_data_source_name:SELECT 1,2,3,4,5 FROM dual;
    in control Block:
    when_button_press my code is
    GO_BLOCK('blk_query');
    Clear_Block(No_Validate);
    set_block_property('blk_query',query_data_source_name,
    'SELECT col1,col2,col3,col4,col5 FROM mytable');
    execute_query;
    same result:unable to query error.
    any one can help me regarding this issue.

  • When trying up date adobe flash player from 10.1.102.64 to new version 10.2.152.26 i get an error message, "Installer will automatically continue when those conflicting applications are closed: [circle w/line through it] Mozilla firefox."

    When trying up date adobe flash player from 10.1.102.64 to new version 10.2.152.26 i get an error message, "Installer will automatically continue when those conflicting applications are closed: [circle w/line through it] Mozilla firefox."

    Save the Flash installer to the desktop and close Firefox via File > Exit Firefox.<br />
    Start the Flash installer via a double-click on the Flash installer icon on the desktop.
    If that still gives problems then see:
    * http://kb.mozillazine.org/Kill_application

  • How to reduce the number of data blocks used by table

    Hi,
    I was trying to reduce the space usage of a particular table of my apex application which stores blob content and therefore deleted many records from it.
    However, the data block usage remained the same as before.
    I have tried to 'analyze' the table and validate the structure,but am unable to overcome this problem.
    Could someone throw some light on what needs to be to reduce the number of data blocks used by this table?
    Best Regards,
    Priya Jetley

    Priya:
    It is likely that the BLOB content defined in your table is being stored 'Out-of-Line'. This means that the LOB columns are stored in segments of their own. These then are the segments that may need shrinking.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_tables.htm#i1006363
    Varad

  • Block with query data source tipe: from clause query

    I have a block that have this property.
    But now I want to change data.
    Do you know how to do it?

    A from clause query does what is says: it can only query data. For DML operations use Table/Procedure.
    hth,
    J

  • From Clause query with form variables

    forms 9.0.4 rdbms 9.2
    Is it possible to create a From Clause query with form variables generated from another block (but in the same form)? I am not having any success.
    I searched Metalink. It appears that according to DOC ID # 69884.1, in Forms 6i, this is not possible. Metalink suggest in DOC ID 104771.1 implementating a dynamic From Clause, but when I duplicate the example on my system, I receive an Oracle error. Further investigation from the web form (DISPLAY ERROR) indicates that the system does not see the dynamic value.
    Has anyone else run into this error? Has this been fixed in forms 9.0.4 and I am just missing something? Does a dynamic from clause query work? Can anyone point me to an example or post an example or offer any advise.
    thanks in advance

    As far as I know it is not possible to use block items in a from clause query in forms 9.0.4. Here is my solution for a From-Clause-Query via the 'Query-Data-Source-Name-Property':
    To use the values of the block items in my from clause query I implemented a database package with getter and setter routines for the block item values I needed for the query.
    In the Key-Exeqry-Trigger of the From-Clause-Query-Block I set the global package variables with values of the block-items I am interested in. In the From-Clause-Query I used the values in the where-clause via package functions which return the global package variables.
    Hope my solution will work for your problem.

  • From clause query works ok in form designer,  gets an ORA-01422 ran on web

    I am using forms 6i patch 9 with 10g database.
    I have two ‘FROM clause queries’ fired via a block/key-exeqry trigger in a if/elsif.
    The first/top SET BLOCK PROPERTY works perfect and populates the block.
    But the bottom/second SET BLOCK PROPERTY select (after the elsif)
    Is also based on a user entered field value and generates a ora-01422 error.
    The problem is that both top and bottom set block properties
    work fine when ran in forms designer,
    But when I compile it on the app_server and run the web version
    1. the top all ‘FROM clause query’ works fine
    2. the bottom ‘FROM clause query’ works fine if only one record to return.
    3. the bottom ‘FROM clause query’: gets the ora-01422 if > 1 record to return.
    FRM-40735: KEY–EXEQRY trigger raised unhandled exception ORA-01422
    The ORA-01422: ‘Exact fetch returned more than the exact number of rows’.
    Both set block property selects ‘share’ a block property/where clause of FAC_ID = :FACILITIES.ID
    The entered value in the entry field should populate 1 to many associated records
    in the bottom (elsif) set block property (and does so correctly when ran in forms designer)
    The block’s key-exeqry code:
    –-query all records associated with fac_id only
    if (:emission_stacks.stack_id_num is null) then
         SET_BLOCK_PROPERTY('EMISSION_STACKS',QUERY_DATA_SOURCE_NAME,
         '(SELECT C.ID, A.ID EP_ID,A.FAC_ID,A.NUM,A.DESCRIPTION,C.PARENT_MODE_ID,
    C.STACK_ID, C.CAPTURE_PERCENT, C.CAPTURE_METHOD, C.DATE_TESTED
    FROM EMISSION_POINTS A,
    EP_MODES B,
    CAPTURING_DEVICES C
    WHERE A.ID = B.EP_ID AND
    B.ID = C.PARENT_MODE_ID AND
    C.CD_ID IS NULL AND
    C.PARENT_MODE_ID IS NOT NULL AND
    C.STACK_ID IS NOT NULL)');
    EXECUTE_QUERY;
    elsif
    (:emission_stacks.stack_id_num is not null) then
    –-(query all records associated with fac_id and the entry field value)
    SET_BLOCK_PROPERTY('EMISSION_STACKS',QUERY_DATA_SOURCE_NAME,
         '(SELECT C.ID, A.ID EP_ID, A.FAC_ID, A.NUM, A.DESCRIPTION, C.PARENT_MODE_ID,
    C.STACK_ID, C.CAPTURE_PERCENT, C.CAPTURE_METHOD, C.DATE_TESTED
    FROM EMISSION_POINTS A,
    EP_MODES B,
    CAPTURING_DEVICES C,
    STACKS S
    WHERE A.ID = B.EP_ID AND
    B.ID = C.PARENT_MODE_ID AND
    C.STACK_ID = S.ID AND
    C.CD_ID IS NULL AND
    C.PARENT_MODE_ID IS NOT NULL AND
    C.STACK_ID IS NOT NULL AND
    S.NUM = '''||:emission_stacks.stack_id_num||''')');
    EXECUTE_QUERY;
    ** I have multiple database items in the block.
    Data block properties:
    Database/
    Data Base Block = Yes
    Query Allowed= Yes
    Is there a way to overcome the ora-01422?
    And populate the block with multiple rows(records)?
    Any suggestions appreciated.

    Sorry, false alarm, I made a mistake
    the form is working fine the way it should,
    without error. (No ora-01422 errror is occurring now.)
    I just got a new version of humming bird,
    which I used to compile the form with
    and did not have the binary switch on:
    --long story short, a new fmx was not created
    and I was not seeing the current version of screen
    at runtime.
    Thank you.

Maybe you are looking for

  • Error ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

    hi, i try to connect to oracle in c#2005. I'm using oralce 10.2.0.3.0 in window vista. i can connect as user scott , but can't do the same thing with use sys like sysdba. i encouter error : "ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

  • Query on Increment Process

    Our customer wishes to handle the increment process in the following manner: 1. For employees, who have put in MORE than 1 yr of service in company as on 1st April, the increment amount to be processed through the Annual Increment process. In this me

  • Reg: material cash discounts

    hello friends, I understand that cash discounts taken from vendors will do settings in OBXU, OBB8. for MIGO cash discounts where we do the cash discount configuration, is that in OBYC, if so let me know the transaction we use for that. i knew that fo

  • Virus Warnings-Popup?

    I have Safari & FireFox browsers and itt doesn't seem to matter which one I'm on, this virus warning keeps popping up and completely shutting me down until I force quit and start over. I believe it to be a sales pitch, but I am not interested. How do

  • Can FCP log and transfer footage from the Panasonic full HD 1080p camcorder

    Hi, my subject heading says it all. But I have read a review of the current consumer HD camcorders from Panasonic that says they have their own codec, and that it cannot be edited on any software but their own, which is not available in a Mac version