How to use From clause as a block datasources

Hi,
I want to know how to use from clause as a block datasource.
Could anyone give me an example to do that? I couldn't find it
in the help file.
I sincerely ask someone help me.
Many thanks
Diana

Diana,
I presume you are getting a "FRM-40505: error unable to perform
query" when you try to execute query. I suggest you select the
"Display Error" item from the "Help" menu to see the query that
Oracle is generating. If the query that Oracle generates as a
result of your "Query data source name" is not formed correctly,
you will get the FRM-40505 error.
Copy and paste the query that is displayed into SQLPLUS and test
to see what happens when you try to execute the query from
SQLPLUS. That will give you a better idea of what the cause of
the problem is.
From your example, a query that works should look like "select
c_no from (select c_no from books)".
Keep in mind that for blocks based on FROM clause, the query that
produces the data is of the form :
SELECT <all columns in the block>
FROM <select statement entered in the "Query Data Source Name"
blockproperty>
The data source for the block is the select statement embedded in
the from clause.
Hope this helps.

Similar Messages

  • 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.

  • Can any one tell me how to use EXISTS clause inplace of IN operator.

    Hi All,
    Can any one tell me how to use EXISTS clause AND (JC.EMPL_ID, JC.EMPL_RCD) inplace of IN operator.
    SELECT COUNT (1)
    FROM SYSADM.OHR_PERS_CURR PC
    , SYSADM.OHR_JOB_CURR JC
    WHERE PC.EMPL_ID = JC.EMPL_ID
    AND (JC.EMPL_ID, JC.EMPL_RCD) in (
    SELECT HS.EMPL_ID, HS.EMPL_RCD
    FROM SYSADM.HU_SCRTY_JOB HS, ODSHR.OHR_SCRTY_USER_CFG OS
    WHERE HS.HU_SCRTY_CFG_ID = OS.HU_SCRTY_CFG_ID
    AND OS.DB_LOGIN = USER)
    Thank you.

    SELECT COUNT (1)
    FROM SYSADM.OHR_PERS_CURR PC
    , SYSADM.OHR_JOB_CURR JC
    WHERE PC.EMPL_ID = JC.EMPL_ID
    AND EXISTS (
    SELECT null
    FROM SYSADM.HU_SCRTY_JOB HS, ODSHR.OHR_SCRTY_USER_CFG OS
    WHERE HS.HU_SCRTY_CFG_ID = OS.HU_SCRTY_CFG_ID
    AND OS.DB_LOGIN = USER
    AND HS.EMPL_ID = JS.EMPL_ID AND HS.EMPL_RCD = JC.EMPL_RCD)
    But why ?
    Rgds.

  • Using from clause property

    i have written a query using joins inorder to get data from various tables.i have used FROM CLAUSE QUERY property and placed the quuery in the property pallate.now when Find button is pressed the data is not getting populated..please guide me in getting the data.

    Hi ,
    After creating your Data Block which is based on a FROM Query , start insearting the items into that block and map the Fields that would be returned from the Select statement to the items on your Data Block , thats all you need to do ,
    Regards,

  • 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...

  • How to use dvb to find which blocks are corrupted?

    hi
    how to use dvb to find which blocks are corrupted?
    and how to repair it from two days back user managed back up when database is in no archive log mode?
    rgrds
    Edited by: new2appsdba on Jul 30, 2010 9:50 PM

    Hi,
    Please see these documents.
    Note: 434013.1 - HOW TO TROUBLESHOOT AND RESOLVE an ORA-1110
    Note: 352907.1 - Script To Run DBV On All Datafiles Of the Database
    Note: 836658.1 - Identify the corruption extension using RMAN/DBV/ANALYZE etc
    Note: 35512.1 - DBVERIFY - Database file Verification Utility (7.3.2 - 10.2)
    Note: 403747.1 - FAQ: Physical Corruption
    Note: 28814.1 - Handling Oracle Block Corruptions in Oracle7/8/8i/9i/10g/11g
    Thanks,
    Hussein

  • How to use WHERE Clause in BPEL

    Hi ,
    i am trying to use where clause in DB adapter but its not working.
    my query is "select empname from employee where empid = &a"
    can any body tell me what is the reason its npt working?
    and how can i retrive data form DB?

    Hi,
    You are thinking perfectly fine. The solution what I suggested was
    select ename from emp where empno=?
    And the solution provided by you was
    SELECT first_name, last_name FROM per_all_people_f WHERE person_id = #p_person_id
    There is no problem with the above mentioned select statements.
    I just want to say that if you see closely, internal logic changes #parameter name to ?. So both the logics are right.
    Cheers,
    Abhi...

  • How to use where clause with get statement in LDB programs

    Hi All,
    I am using logical databse in my report program.I am not getting how to use the where clause in the get statement is it possible to use?or if not possible only option is we should filter it after get statment is right?Can you please some body throw some idea on this?
    Regards
    Mahesh

    Hi,
    Reffer these links
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    reward if helpful
    Thanks,
    Suma.

  • 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.

  • How to use a stored procedure as a datasource in Crystal Report for Eclipse

    Hi All,
    I've written a stored procedure in oracle 10g with few input parameters and one refcursor output parameter. I want to use this stored procedure as a data source for creating a report in "Crystal Report For Eclipse 3.6.0".
    When I tried to add this stored procedure to the report using the connection explorer, I don't see any option to do this. But when I try to add any table, it shows options like "Add to the current report"....
    Can anybody assist me how to use a stored procedure as a data source in "Crystal Report For Eclipse"?
    Which driver should I use to connect to the oracle database? I tried using JDBC Driver for Oracle.
    Thanks in advance.

    Did you solve your problem? How did you do?

  • How to use a Crystal Reports Query as datasourc in an other Cristal Report

    Hi
    I would like to read a File in a CR Report, change some data and use the output as datasource  in an other Criystal Reports Report.
    Is ist possible to use a Crystal Reports Report as datasource for an other Crystal Reports Report?
    Thomas
    Edited by: Thomas Martin on Jul 18, 2011 12:44 PM

    Hi Thomas,
    Are you having Xcelsius also in your kitty??(for dynamically doing this activity)
    Xcelsius has very good writing & reading functionality and you can incorporate your crystal report data into it using live office.
    Let say you have a report in crystal , you connect that repot to live office .Let say this is REPORT named as SOURCE CR  REPORT.
    IN Xcelsius import the this SOURCE CR REPORT  report using live office connection and using GRID selector there to show tabular data.
    Xcelsius has buttons & controls  for updating and exporting the data inform of XML SOURCE FILE.
    Now you can either make xcelsius Dashboard for TARGET CR REPORT or you can make crystal Report on ADO.NET(XML) for second crystal Report.
    Search on SDN for cross usage of Crystal & Xcelsius
    regards,
    RK

  • How to use "where" clause in modify statement

    Hi
    can any1 telll me is it possible to use a where clause in a modify statemetn. I want to use modify statemetn  to insert a new recoed in a database table.
    Regards
    Sabahuddin Ahmed

    MODIFY itab - itab_lines
    Syntax :
    ... itab FROM wa TRANSPORTING comp1 comp2 ... WHERE log_exp.
    With these additions the MODIFY statement assigns the content of the comp1 comp2 ... components of the wa work area specified after TRANSPORTING to all lines in the itab table that meet the logical condition log_exp. The wa work area must be compatible with the line type of the internal table.
    The TRANSPORTING addition has the same effect as changing individual lines. The WHERE addition can only be specified together with the TRANSPORTING addition. After WHERE, any logical expression can be specified in which the first operand of each individual comparison is a component of the internal table. All logical expressions are therefore possible, with the exception of IS ASSIGNED, , and IS SUPPLIED. It is not possible to dynamically specify a component using bracketed character-type data objects.
    While for standard tables and hashed tables all lines in the internal table are checked for the logical expression of the WHERE statement, for sorted tables, optimized access can be achieved by checking at least one opening part of the table key for parity using AND linked queries in the logical expression.
    Example
    Change the contents of the planetype component for all lines in the sflight_tab internal table in which this component contains the value p_plane1 to the value p_plane2.
    PARAMETERS: p_carrid TYPE sflight-carrid,
                p_connid TYPE sflight-connid,
                p_plane1 TYPE sflight-planetype,
                p_plane2 TYPE sflight-planetype.
    DATA sflight_tab TYPE SORTED TABLE OF sflight
                     WITH UNIQUE KEY carrid connid fldate.
    DATA sflight_wa TYPE sflight.
    SELECT *
           FROM sflight
           INTO TABLE sflight_tab
           WHERE carrid = p_carrid AND
                 connid = p_connid.
    sflight_wa-planetype = p_plane2.
    MODIFY sflight_tab FROM sflight_wa
           TRANSPORTING planetype WHERE planetype = p_plane1.
    reward if useful

  • How to use session variables in initialization blocks

    Hello,
    I want to use a session variable in a initialization block. Here is what I was doing to see this working
    I created a init block called name_parameter and associated with a variable target named name_parameter_v. The init string for this block is "select 'Hello' from dual".
    i created another init block name_parameter2 and associated with a variable target named name_parameter2_v. The init string is "select :name_parameter_v from dual".
    I have selected name_parameter in the edit execution precedence for name_parameter2.
    The result set is empty. Could you please explain why I am not able to see Hello when i test name_parameter2.
    Thanks.

    to obtain the value contained in a session variable this is the syntax.
    select 'VALUEOF(NQ_SESSION.VARIABLE_NAME)' from dual
    mind the single quotes, they are necessary

  • How to use where clause

    Hello,
    I am using sapnwrfc  for perl to get few information about SAP system.  To get the Applications pruning on SAP system i need to use two tables DF14AVD and DF14T to get Application Name and Description.  table DF14T  contains description of the application. 
    I want to know using QUERY_TABLE how i can combined it and get desired result. 
    For ex. FCTR_ID is present in both the table. FCTR_ID which are present in DF14AVD  table, i want to retrieve short description from  DF14T .
    Any idea how i can do this?
    Amit

    Hi,
    You can refer to the following link.
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/4b/38b618068911d295300000e8353423/frameset.htm
    Thank You.
    Regards,
    Dhanalakshmi L

  • How to use model clause without hard coding the values in it?

    Query
    select acct_no,
           gl_code,
           CASE
             WHEN entry_type_label IN ('Earned Revenue') THEN
              'Earned Revenue'
             ELSE
              'Deferred Revenue Credit'
           END AS entry_type_label,
           CASE
             WHEN entry_type_label IN ('Opening Balance') THEN
              'Opening Balance'
             WHEN entry_type_label IN ('Deferred Revenue Credit') THEN
              'Invoice Amount'
             WHEN entry_type_label IN ('Earned Revenue') THEN
              'Earned Revenue'
             WHEN entry_type_label IN ('Closing Balance') THEN
              'Closing Balance'
             ELSE
              'Deferred Revenue Credit'
           END AS label,
           entry_type_no,
           orig_chg_start_date,
           period_no,
           -amt as amt
      from revrec_test
    WHERE acct_no = 1788562
       AND entry_type_no IN (2, 4) model dimension by(acct_no,
              gl_code,
              entry_type_label,
              entry_type_no,
              orig_chg_start_date,
              period_no) measures(amt) rules upsert
    all(amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190 = amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               190 - amt 1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               190,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               191 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 191 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 191) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               191,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               192 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 192 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 192) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               192,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               193 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               193 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               193 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 193 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 193) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               193)
    ORDER BY period_no, entry_type_no;
    The above query works fine. But i have hard coded the values. I want to do the same operation for different account number which is going to have different periodic no. How can I achieve it?
    Thanks in advance.

    Create Statement
    CREATE TABLE table_one(
    ACCT_NO             NUMBER(38),                                               
    GL_CODE             VARCHAR2(300),
    ENTRY_TYPE_LABEL    CHAR(50),                                                  
    ENTRY_TYPE_NO       NUMBER,                                                    
    ORIG_CHG_START_DATE TIMESTAMP(0) WITH LOCAL TIME ZONE,
    ORIG_CHG_END_DATE   TIMESTAMP(0) WITH LOCAL TIME ZONE,
    PERIOD_NO           NUMBER(38),
    AMT                 NUMBER(38,10)
    Insert Statement
    INSERT ALL
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,13.87)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',102,-14.83)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',101,-14.35)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,-13.87)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',103,0.95)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',102,14.83)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',101,14.35)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',103,-0.95)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Credit',2,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,-44)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,60)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,3.93)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,11.75)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,6.86)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-7.82)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-23.47)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-13.69)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-6.86)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,7.82)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,23.47)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,13.69)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,-9.13)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-35.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-3.93)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,9.13)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-11.75)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,38.48)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-19.24)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,-60)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,38.48)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,19.24)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,35.91)
    SELECT * FROM dual;
    Expected Result
    S.NO
    ACCT_NO
    GL_CODE
    ENTRY_TYPE_LABEL
    ENTRY_TYPE_NO
    ORIG_CHG_START_DATE
    PERIOD_NO
    AMT
    DESCRIPTION
    1
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    0
    Opening Account
    2
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    44
    Invoice
    3
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    100
    13.87
    Invoice Paid
    4
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    30.13
    Closing Account
    5
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    30.13
    Opening Account
    6
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    0
    Invoice
    7
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    101
    14.35
    Invoice Paid
    8
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    15.78
    Closing Account
    9
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    15.78
    Opening Account
    10
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    0
    Invoice
    11
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    102
    14.83
    Invoice Paid
    12
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    0.95
    Closing Account
    13
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0.95
    Opening Account
    14
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0
    Invoice
    15
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    103
    0.95
    Invoice Paid
    16
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0
    Closing Account
    Description
    We must start opening account as zero and end with closing account as zero by doing manipulation with invoice and invoice paid.
    Process
    Initial Stage
    Subsequent stage
    Opening Account
    0
    (=closing Account)
    Invoice
    max value of account no which has entry type no 2
    0
    Invoice Paid
    taken from the  field amount which has entry type no 4
    taken from the  field amount which has entry type no 4
    Closing Account
    (=[opening account + invoice] - invoice paid)
    (=[opening account + invoice] - invoice paid)
    Note
    1) Each account may have different periodic no.
    2) Some account may have more than 4 distinct period no and less than 4 distinct periodic no.
    3) Description column from expected result is not an part of table. It is been added for easier understanding.

Maybe you are looking for

  • How do i authorize my macbook pro to download apps

    how do i authorize my macbook pro to download apps

  • Filesystem Error (UDev and mounting)

    I'm having trouble with my filesystem(s) on startup. These problems began after I cleaned my case using compressed air / vacuum, though I don't think I jostled any hardware. My original filesystem was set up like this: /dev/sda1 NTFS WinXP partition

  • Satellite view on navigation

    Hi, is it possible to use the satellite view during navigation? Is saw this with the Google Maps navigation app and I'm wondering now, if it's possible with Nokia Maps, too. Noknak Solved! Go to Solution.

  • GETWA_NOT_ASSIGNED in Transaction VA42

    Hi all, One of my user have got a runtime error in the transaction VA42 where we have added our customized code.The Main Program is SAPMV45A.I have attached some of the dump details below. <b>Runtime Error          GETWA_NOT_ASSIGNED ShrtText     Fie

  • Stuttering Audio from Capture Ingest

    I have been having a problem for a while now.  When ingesting a tape or direct line, sometimes the audio on the record will begin stuttering.  At a seemingly random point, the audio of the record will begin to loop a 1 second bite over and over until