Why same query runs on isqlplus but not in Forms/Reports trigger

Hi,
I have one query in which I extract one column with parent table join if I run same query on isqlplus prompt it works but if I run same on Forms/Reports trigger it says found "select" where something else expected.
below is an example .
select em1.mreading, em1.grid_code,
(select em.mreading from energy_mreading em where em.grid_code=em1.grid_code and em.transformer_code=em1.transformer_code
and em.bus_bar=em1.bus_bar and to_date(to_char(em.r_date,'dd/mm/yyyy'),'dd/mm/yy') = to_date('02/01/07' ,'dd/mm/yy') - 1)
as Yreading
from energy_mreading em1
where to_date(to_char(em1.r_date,'dd/mm/yyyy'),'dd/mm/yy')= to_date('02/01/07' ,'dd/mm/yy')
Any one can help me, is there any restriction/limitations in Forms/Reports triggers.
Thanks, Khawar.

In forms and cursors you can not use scalar subqueries as you do. You have to use joins!
select
     em1.mreading
    ,em1.grid_code
    ,em.mreading as Yreading
from
    energy_mreading em1
   ,energy_mreading em
where 1=1
    and trunc(em1.r_date) = to_date('02/01/2007','dd/mm/rrrr')
    and em.grid_code = em1.grid_code
    and em.transformer_code = em1.transformer_code
    and em.bus_bar = em1.bus_bar
    and trunc(em.r_date) = trunc(em1.r_date) - 1
Try this, hope it works.

Similar Messages

  • Query running in Quality but not in Production

    Hi Folks,
    we are running a query AQICSDUSERS=====MOVEMENTLIST4= which used to get executed previously,but all of a sudden now after running for an hour or so it is coming back to  sap easy access screen without displaying the report.It is running and giving the report in Quality but not in Production.
    What could be the reason?
    K.Kiran.

    Hi Folks,
    From DUMP I got this:-
    <b>You should usually execute long-running programs as batch jobs.
    If this is not possible, increase the system profile parameter
    "rdisp/max_wprun_time".</b>
    I want to know how to increase the system profile parameter
    "rdisp/max_wprun_time".
    Thanks,
    K.Kiran.

  • This query works in TOAD but not in forms 6i,

    Hi,
    It shows error identifier 'ATTRIBUTES' must be declared. what is this error about ?
    BEGIN
    select distinct B.TEXT into v_lbl
    from
    SAMS S, TABLE(ATTRIBUTES) A, TABLE(ATTRIBUTES) B, LOCATIONS LS
    where
    S.ID = :P_ ID and
    A.NAME = 'DISL' and
    B.NAME='BL'
    SL.ID(+) = S.ID and
    SL.STAT(+) = 'HIGH' ;
    return(v_lbl);
    END;
    Thanks
    Bcj

    returning valueswhat values? 1 or more?
    when i compile it shows the errorwhat's the error?

  • Query working in sql but not in forms

    hi this is my query
    insert into sa_prod_temp
    select sa_idno,sa_srno_desc,count(*) qty from sa_master,
              select sa_code,sa_idno,sa_prod_date,sa_srno,sa_srno1 from
                   select sa_code,sa_idno,sa_prod_date,sa_srno,sa_srno1 from bom_sa_prod
                   order by sa_prod_date desc
              where rownum <=50
         ) b
         where sa_type = :dummy.sa_code and sa_type = sa_code
         and sa_master.sa_srno = b.sa_idno
         group by sa_idno,sa_srno_desc     ;

    insert into sa_prod_temp
    select sa_idno,sa_srno_desc,count(*) qty from sa_master,
    select sa_code,sa_idno,sa_prod_date,sa_srno,sa_srno1 from
    select sa_code,sa_idno,sa_prod_date,sa_srno,sa_srno1 from bom_sa_prod
    order by sa_prod_date desc
    where rownum <=50
    ) b
    where sa_type = :dummy.sa_code and sa_type = sa_code
    and sa_master.sa_srno = b.sa_idno
    group by sa_idno,sa_srno_desc ;
    VALUE CLASS IS MISSING
    -----------------

  • Query on a table runs more than 45mins(after stats) and same query runs 19secs(before stats - rebuild)

    Query on a table runs more than 45mins(after stats) and same query runs 19secs(before stats - rebuild) - Not sure what the cause is.
    - Analysed the explain the plan
    - different explain plan used afterr stats gather.
    Any idea what could be the cause with this kind of difference.
    Thank you!

    What is the difference you see in the explain plan ? Where it spends most time. All these needs to be analysed.

  • Why can I sync a movie but not TV shows on my nano (7th gen)?

    I am using iTunes 11.0 and can sync a movie (Miracle on 34th Street) to my new ipod nano 7th gen but when I try a TV Show (a Planet Earth HD episode) or even a brief video clip taken with my camara I am told that such an action is not permitted on this ipod.  So why can I sync a movie but not TV shows on my nano (7th gen)?  Thank you.

    Before you can sync video files, it must be converted into a format compatible with ipod.  If you can’t sync a video convert it by doing the following:
    In iTunes, select the video you want to convert. Do one of the following then sync again after:
    1) Choose File > Create New Version > Create iPod or iPhone Version.
    2) Choose File > Create New Version > Create iPad or Apple TV Version.
    I hope this works.

  • Why can I receive text messages but not send?

    Why can I receive text messages but not send. This has been happening for about 10 hours.

    Thanks for the response. Must be smart phones. My daughter has a dumb phone and she can send out. I tried deleting my text messages on the Verizon website, but they won’t delete. It must be on their end. Chat line was busy forever, until they shut it down.
    Jennifer

  • I have just signed upfor family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time?

    I have just signed up for family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time?

    hi, the app is not "shared", it works as if you bought the app twice with different accounts, only you paid it once. they should have 2 different villages since they're on 2 different devices.

  • How to use HOST call DOS continuous running problem but NOT hold Forms scre

    In my Forms, I have a Button a start a MP3 recorder program to record voice, I use HOST command to init the program successfully. However, since the MP3 recorder program in continuous running, the HOST command hold my Forms screen until the MP3 program stop.
    I have try to use Open_form to open another form to start this MP3 program. It still hold the whole Forms system.
    Is there any solution to start a continuous running DOS program but NOT hold the Forms screen?
    Thank You !

    You didn't provide your host-command, so i simply guess its something like
    HOST('"c:\Program Files\mp3.exe" someoptions');instead of calling the program directly, you could use a commadn batch along with the start-command, for this should launch the program asynchronously:
    HOST('cmd /c start "c:\Program Files\mp3.exe" someoptions');hope this helps.

  • Why will the iOS 7 download but not install?

    why will the iOS 7 download but not install?

    IOS 7 stinks wrote:
    I made the mistake go read the internet
    It would take a very long time to read the entire Internet. There are billions of pages.

  • Query runs in TOAD but hangs in Reports

    How does one begin to diagnose where a query run in Reports is hanging? The query runs in TOAD but never finishes when run within the report. Strange thing is that the query/report ran (unchanged from this month) for prior months.
    Is there a "run-time visual debugger" for reports?

    Each query, including the 5th, runs to completion when run separately. It appears to be the addition of the 5th query which causes the problem.
    NEWS FLASH: The report ran to completion over the weekend (almost totally idle server). However, it took over 90 minutes to finish.
    Immediately after optimizing the queries and indicies, the report has been known to complete in 3 minutes. Over time, this has crept back up to 20 minutes.
    The DBAs think a change in DBMS optimization might have caused this particular query to exceed a threshhold. They're looking at reversing this change to see the affect on the query.

  • Why can i send imessage texts but not sms texts ?

    why can i send imessage texts but not sms texts ?
    When i try to send an sms text ..i get a 'not delivered' message...no error code...imessage works fine...

        Very strange, [email protected] Let's get this figured out. Make sure that SMS messages are turned on. Go to Settings>Messages>Send as SMS. Please let me know if this works.
    ChaunceyM_VZW
    Follow us on twitter @VZWSupport

  • Why will icloud update my contacts, but not my calendar (ie birthdays) I have the "show birthday calendar" ticked

    why will icloud update my contacts, but not my calendar (ie birthdays) I have the "show birthday calendar" ticked

    why will icloud update my contacts, but not my calendar (ie birthdays) I have the "show birthday calendar" ticked

  • Connect by prior working in sql but not in forms 10g hierarchical tree

    Hello Friends,
    I have the following connect by prior example which is working in sql command prompt but not in Forms 10g hierarchical tree item type. Can you please let me know why ?
    configuration: Forms 10g patchset 10.1.2.0.2 and oracle 11g database on windows 7
    SQL> SELECT 1 InitialState,
    2 level Depth,
    3 labeller NodeLabel,
    4 NULL NodeIcon,
    5 to_char(reportno) NodeValue
    6 FROM reports where formname = 'billinin.fmx' or reportno > 9999
    7 start with reportno > 9999
    8 CONNECT BY PRIOR reportno = labelno
    9 /
    INITIALSTATE DEPTH NODELABEL N NODEVALUE
    1 1 FIRST 10000
    1 2 report1 UD Label 1
    1 2 report2 UD Label 2
    1 2 report3 UD Label 3
    1 1 SECOND 10001
    1 1 THIRD 10002
    If I write this command in forms hierarchical tree, then it is working, why not the above code ?
    SQL> SELECT 1 InitialState,
    2 level Depth,
    3 labeller NodeLabel,
    4 NULL NodeIcon,
    5 to_char(reportno) NodeValue
    6 FROM reports
    7 start with reportno > 9999
    8 CONNECT BY PRIOR reportno = labelno

    Thanks Room,
    This command worked ! I will put the sample working code here. It will help you to filter the records in a tree in sql command prompt as well as in forms hierarchical tree 10g.
    SELECT 1 InitialState,
    level Depth,
    labeller NodeLabel,
    NULL NodeIcon,
    to_char(reportno) NodeValue
    FROM reports
    start with reportno > 9999
    CONNECT BY PRIOR reportno = labelno
    AND FORMNAME = :reports.testitem

  • Value in KEAW but not in S_ALR report for a particular account

    Hello,
    Find value in CO in KEAW for a particular account but not in S_ALR_87013542 report . The account belongs to Cost of sales category .
    Can someone please inform the reason for this posting not appearing in S_ALR but in KEAW .
    With regards,
    Mrinal

    Derek,
    Please read the following from Anton Nielsen...
    http://c2anton.blogspot.com/2008/12/oracle-application-express-apex-three.html
    Let us know if you have questions after.
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen

Maybe you are looking for