Report based on a ITEM (which has SQL statement)

Hi everyone,
I have a created a form based on a table which has 1 column that stores SQL statement in the database.And i am displaying the SQL statement in TEXT AREA FILED.
What i want to do is to create a report based on that SQL statement (Which is in the TEXT AREA field on the same page).I tried to create a report region with
:P25_SQL_STATEMENT.But i am getting an error
----->invalid query, no select statement found.
How can i do a report based on the item which has SQL query in it.
Thanks
phani
.

Hi Jkallman,
Thanks for the reply.I have a (FORM WITH REPORT) on a table which has column of SQL_STMNT VARCHAR2(2000 BYTE) which takes the SQL statement entered from the FORM.
1.I have a report which shows all the records in the above mention table on page 10
2.If i hit the edit button in the report i go to page 11 which i have the FORM on the above mentioned table.In that form i have a field :P11_SQL_STMNT.
3.I am trying to create a report on the same page 11 based on the SQL query of that :P11_SQL_STMNT.
4.I did the follwoing steps
--> create a region
----> report
---->sql report
and entered the following code.
begin
return (:P11_SQL_STMNT);
end;
but it is giving me the error which i mentioned in the previous post.If u need any more details i can provide
Thanks in advance
phani

Similar Messages

  • How to create a report  based on selected item from Select list?

    Hi,
    I have created a tables_LOV based on:
    select table_name d, table_name r from user_tab_cols
    where column_name like '%_type%'
    Then I created a page item ListOfTables,  Display as select list and pointing to tables_LOV.
    I run the page, and i can select the table i want from the drop down list.
    How to create a report  based on the selected item? (ex: select * from selected_table)
    many thanks in advance
    Salah

    Hi Salah,
    Allright, have a look at this page: http://apex.oracle.com/pls/apex/f?p=vincentdeelen:collection_report
    I think that simulates what you're trying to accomplish. I've set up the simplest method I could think of.
    The report is based on an apex collection. If you are not familiar with that, you should study the documentation: APEX_COLLECTION
    To recreate my example you should:
    1) create an (interactive) report on your collection
    SELECT *
       FROM APEX_collections
    WHERE collection_name = 'MY_COLLECTION'
    2) create a page_item select list for the tables you want to display (in my case this is called "P38_TABLES" )
    3) create a dynamic action that triggers on change of your select list page_item. The dynamic action must be a PL/SQL procedure perfoming the following code:
    declare
      l_query varchar2(4000);
    begin
      l_query := 'select * from '||:P38_TABLES;
      if apex_collection.collection_exists
            ( p_collection_name => 'MY_COLLECTION' )
      then
        apex_collection.delete_collection
          ( p_collection_name => 'MY_COLLECTION' );
      end if;
      apex_collection.create_collection_from_query
        ( p_collection_name => 'MY_COLLECTION'
        , p_query           => l_query
    end;
    Make sure you add your page_item to the "Page Items to Submit" section.
    4) Add an extra true action that does a refresh of the report region.
    Here are two pictures describing the da:
    http://www.vincentdeelen.com/images/otn/OTN_COLLECTION_REPORT_DA1.png
    http://www.vincentdeelen.com/images/otn/OTN_COLLECTION_REPORT_DA2.png
    Good luck and regards,
    Vincent
    http://vincentdeelen.blogspot.com

  • Standard report to show Raw Material which has been consume

    Hi,
    My plant controller would like to know for particular of raw material has been consume by which style number for particular period of time. Example:- Material A has been consume by style number A - 6 pc, B - 4 pc and C - 2 pc
    Do SAP has standard report to display all this information.
    Pls. help.

    Hi,
    Use t-code COOIS and follow below activities -
    List - Documented goods movement ---> production order ---> plant ---> Execute
    All the components will appear with movement type 261 and 101.
    select only 261 movement type materials.
    These are your RAW material which has been consumed against subjected production order.
    Thanks,
    Rampreet Jaiswal

  • How to repair an item which has damaged during transit?

    Hi All, Good Day !
    I have a situation where an item (material) which has damaged during transit (from one plant to another plant), needs to be repaired in house (by plant maintenance)
    Incidentally, this item (material) belongs to the inventory and does not have any equipment master created.
    Is there any way to get this item repaired within PM module and capture the costs to the material or stores?
    I know that we can get this done through PM04 order type (refurbishment order) to certain extent, but I want to avoid this process.
    Pls. suggest if any alternate process available which could capture this process.
    Thanks in advance and Best Regards
    JK

    JK,
    Sorry - didn't read you post properly...
    You could either use the Assembly field the Reference Object sub-screen of a standard order, or change the Reference Object sub-screen to one that has a material (see menu path IW32->Extras->Settings->Reference Object View and try screen O130)
    You may also need to create a PM Activity Type to denote this order as a refurbishment order.
    Then process your order like any other.
    PeteA

  • Can I pass parameters from a dashboard via a dashboard prompt and presentation variable to publisher report based on a data model with select statements in OBIEE 11g ?

    I have a publisher 11g (v 11.1.1.7)  report with a single parameter. The report is based on a data model not a subject area.  I created a dashboard put a dashboard prompt and link to the report in separate section on the same page.  The dashboard prompt sets a presentation variable named the same as the parameter in the report. 
    The problem was when I created the dashboard prompt, it forced me to select a subject area which I did (though did not want to) and then I created both a column and variable prompts. But clicking on the
    report link completely ignored the value that I thought would be passed in the presentation variable to the report.
    Side note :  My report uses a pdf template for its layout where I have mapped the columns names from my data model to the form fields on the pdf form.  I noticed that if I create a publisher report based on a subject area, then I do not have the choice to choose a PDF as a template type for my layout.  (I only see BI Publisher Template as a choice). 
    I see some documentation online that suggest it could be done in 10g.
    Thanks
    M. Jamal

    Ok,
    I just tried that and it still doesn't pass anything to the prompt.
    I changed the prompt to an edit field and I made the following weblink but when i click the link from an account it doesn't put anything in the prompt and all data for all accounts is shown.
    This is the URL maybe I messed something up...
    https://secure-ausomx###.crmondemand.com/OnDemand/user/Dashboard?OMTHD=ShowDashboard&OMTGT=ReportIFrame&SelDashboardFrm.Dashboard Type=%2fshared%2fCompany_########_Shared_Folder%2f_portal%2f360+Report&Option=rfd&Action=Navigate&P0=1&P1=eq&P2=Account."Account Name"&P3=%%%Name%%%
    thanks

  • Trying to produce report but have ERROR ORA-00900: invalid SQL statement

    Hi,
    I am new to Oracle so have been experimenting with a few things to get the hang of it. I have been trying to produce a report, but keep getting the error: ORA-00900: invalid SQL statement.
    This happens at my first line of code where I have COLUMN <column_name> HEADING <Heading_name>
    So I am a bit confused - is there a command that I am supposed to issue that indicates to SQL*Plus that I am trying to create a report?
    Also, if I just delete the COLUMN <column_name> HEADING <Heading_name> rows and just start at BREAK ON <column_name> SKIP 1, it produces the same error.
    I am using Oracle 8.0.6 - does this make a difference?
    Here is my code:
    COLUMN a.p_ctryid HEADING 'Country'
    COLUMN s.p_animid HEADING 'Stallion ID'
    COLUMN s.p_uname HEADING 'Stallion Name'
    COLUMN a.p_animid HEADING 'Horse ID'
    COLUMN d.p_careertp HEADING 'Career'
    BREAK ON s.p_animid SKIP 1
    BREAK ON d.p_careertp SKIP 2
    COMPUTE SUM LABEL 'Total' OF d.p_careertp ON REPORT
    SELECT DISTINCT a.p_ctryid, s.p_animid, s.p_uname, a.p_animid, d.p_careertp
    FROM p_owby.p_animal a, p_owby.p_animal s, p_owby.p_mating m, p_owby.p_anim_dtl d
    WHERE m.p_mateyr = 2001
    AND a.p_animid = d.p_animid
    AND a.p_animid = m.p_animid
    AND a.p_animid > 0
    AND s.p_animid = a.p_sire
    AND a.p_ctryid IN('GB','IRE')
    GROUP BY a.p_ctryid, s.p_animid, s.p_uname, d.p_careertp, a.p_animid
    ORDER BY a.p_ctryid, s.p_animid, d.p_careertp
    Any help would be greatly appreciated!
    Thanks in advance!

    You are trying to do COMPUTE SUM ... ON REPORT but there is no BREAK ON REPORT specified. The computed sum will not be shown unless you also break on report. see below demonstration. first select has no sum even though we have specified COMPUTE. The second select shows the sum since now we have done break on report.
    SQL> compute sum of sal on report
    SQL> select * from scott.emp order by empno ;
         EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10
    14 rows selected.
    SQL> break on report
    SQL> select * from scott.emp order by empno ;
         EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10
    sum                                                         29025
    14 rows selected.
    SQL>

  • Exchange generates failure report emails for Inbox items which haven't attempted to be synced

    Hello,Our ActiveSync client is reporting errors to the user when the user is sent certain types of recurrence invites. If an invite to a meeting is sent from the Outlook Web App to the user, and the user then syncs their Inbox (using our ActiveSync client and the Sync command), instead of receiving the correct email, they will get an email indicating an error:
    From: Microsoft Exchange on Behalf of *user’s name*
    Subject: Synchronization with your WinRT failed for 1 items.
    Body:
    Synchronization with your Winrt failed for 1 items.
    The following items couldn’t be sent to your mobile phone. They haven’t been deleted …
    Item Folder: Inbox
    Item Type: IPM.Schedule.Meeting.Request
    Item Created: *date*
    Item Subject: *subject of missing email*
    (WinRT is the name of our client currently.)
    This occurs consistently when the invite is for a recurring meeting, which occurs on the last day of a month, yearly. (Yearly on the nth day of the month)
    It also seems that after one of these error emails appears, other items start to be added in with it, although this could just be the result on my side from a lot of testing side effects.
    There’s two strange things to note about this error.
    The Exchange server never attempts to even send the items via ActiveSync to our client, so the error does not seem to be caused by our Sync request. I’ve used Fiddler to examine the calls, and we never receive the original message in any form.
    The Windows Mail client (in Windows 8.1), which uses ActiveSync, has no problem Syncing the very same items that are causing the errors to appear. This gives the impression that something can be done to remedy the problem, but I have no idea what.Thanks
    ArchieCoder

    Hello ArchieCoder,
    This is certainly not what I would expect to see. However, I can't say with certainty that it's related to the syncing issue.
    I went back and looked at the Fiddler trace you took from the Windows Mail client. It gets the same FolderSync response. The first three folders in the response look like I expect--Calendar has ServerId 1, Contacts has ServerId 2, and Deleted Items has ServerId
    3. After that, the ServerId value jumps to 11 for the Drafts folder, so it and all of the subsequent folders have a ServerId value that is 7 higher than what I would expect to see.
    What seems especially weird to me is that the Windows Mail client proceeds to issue a Sync request for the list of CollectionIds I reported earlier, despite several of them being absent from the FolderSync response. Furthermore, it looks like the Windows
    Mail client is getting Inbox items that are identified as being in CollectionId 5:
    <?xml version="1.0" encoding="utf-8"?>
    <airsync:Sync xmlns:airsync="AirSync">
       <airsync:Collections>
          <airsync:Collection>
             <airsync:SyncKey>933450273</airsync:SyncKey>
             <airsync:CollectionId>5</airsync:CollectionId>
             <airsync:Status>1</airsync:Status>
             <airsync:Commands>
                <airsync:Add>
                   <airsync:ServerId>5:391</airsync:ServerId>
                   <airsync:ApplicationData>
                      <email:Subject>Canceled: Last day of december</email:Subject>
    I'm really at a loss for what is going on with this. How difficult would it be for you to test this with your client assuming that Inbox is CollectionId 5 instead of the 12 that is returned from the FolderSync? I am afraid we might be focusing too closely
    on this particular aspect of the issue without being sure it could be causing the real problem, so I think it would be good if you can either reproduce the failure syncing CollectionId 5 instead of 12, or show that your client fails in some other way if it
    tries to sync CollectionId 5. A Fiddler trace of the outcome of that test including both the FolderSync response and Sync request/response would be the next logical step here, I think, assuming that that is doable. Please let me know what you think.
    Best regards,
    Matt Weber | Microsoft Open Specifications Team

  • How to create a crosstab based on BW Query which has key figure structure

    Hi,
    We are on CR 2008 SP1.
    We have an existing BW query with custom Characteristics structure in the "Columns" section and a custom Key Fugure structure in the "Rows" section in the BW query designer.
    Cell editor has been used to define formulas of the cells.
    We wish to build a crystal report on top of the query.
    On the crystal report on top of the query we get the characteristics structure and individual key figure elements. As already discussed in multiple fourm posts, this is the expected behaviour.
    We are using a cross tab and in the column section, I have put the "Characteristic" structure  in the  "columns" section in the crosstab using the crosstab expert. This leads to horizonatal column headings as per expectation.
    Within the characteristics structure we have multiple fields which description "%" with diffeent formula's defined on the BW query designer. On the Cyrtsl Report, when we get the columns in the crosstab, we get only a single "%" field. All other "%" fields are not visible.
    A. Is there a way to get all fields in in case of same description?
    I tried putting in the Key Figure elements in the "Rows" section, but was not able to get desired output.
    Experts: Can you advice how this report can be built?
    Any help will be appretiated.
    Rgds

    I am interested... How did you solve it?

  • How to enter the data into data block text item which has an LOV associated

    Hi,
    I have a data block, one of the data block text item has an LOV assigned. when I populate this text item using the LOV and do "execute_query", it is taking the value in the text item and adding it to the search criteria, but when I enter a value manually in that text item and do "execute_query" it is showing me an alert(which I created) "Please enter a value".
    My question is, why is not taking the value that I enter manually? Looks like before executing the query, this field is getting empty
    How to avoid this problem and make sure that the value entered in the text item is added in the where clause of the query?
    Any advice?
    Thanks in advance
    R.G

    Problem solved!
    Before doing execute-query, all the text items are being cleared,so I used a global variable to store that value
    Thanks anyway
    R.G

  • Changing UoM of Item which has a transaction

    we are going to change UoM of one Item in inventory, But this Item has transaction in system , and also some onhand. how we can do this task by consider the cost and quantity?
    thanks

    Dear Farhadn,
    It is not possible to change the items UoM once there are transactions linked to the item. This is the current system definition of SAP Business One.
    However, you can use factors (in the item master data) and Base units in marketing documents as workaround.
    Please, find instructions in the attached document.
    There is also a webex session available on the SAP service market place. Please find below the path to the webex:
    https://websmp207.sap-ag.de/~sapidb/011000358700000050892007E
    Go to Logistics - Inventory and core logistics -> 11.12.2006 - Items per purchase Unit in the Item Master Data
    Regards,
    Varun
    SAP Business One Forum Team

  • Executing String which  has SELECT statement

    String stmt:='Select * from Table a';
    How do I execute the select statement present in the string.
    Thanks for the help in advance

    In most cases this is something you should not be doing on a regular basis. Also when using dynamic sql, take care to use bind variables.
    SQL> create or replace function f (p_stmt varchar2)
      2  return sys_refcursor as
      3    c sys_refcursor;
      4  begin
      5    open c for p_stmt;
      6    return c;
      7  end;
      8  /
    Function created.
    SQL> var c refcursor
    SQL> exec :c := f('select * from emp')
    PL/SQL procedure successfully completed.
    SQL> print c
    EMPNO ENAME      JOB          MGR HIREDATE     SAL   COMM DEPTNO
      7369 SMITH      CLERK       7902 17-DEC-80    800            20
      7499 ALLEN      SALESMAN    7698 20-FEB-81   1600    300     30
      7521 WARD       SALESMAN    7698 22-FEB-81   1250    500     30
      7566 JONES      MANAGER     7839 02-APR-81   2975            20
      7654 MARTIN     SALESMAN    7698 28-SEP-81   1250   1400     30
      7698 BLAKE      MANAGER     7839 01-MAY-81   2850            30
      7782 CLARK      MANAGER     7839 09-JUN-81   2450            10
      7788 SCOTT      ANALYST     7566 09-DEC-82   3000            20
      7839 KING       PRESIDENT        17-NOV-81   5000            10
      7844 TURNER     SALESMAN    7698 08-SEP-81   1500      0     30
      7876 ADAMS      CLERK       7788 12-JAN-83   1100            20
      7900 JAMES      CLERK       7698 03-DEC-81    950            30
      7902 FORD       ANALYST     7566 03-DEC-81   3000            20
      7934 MILLER     CLERK       7782 23-JAN-82   1300            10
    14 rows selected.
    SQL>Given the example in the question, execute immediate wouldn't work, unless the table only had one row or bulk collect was used.

  • Executing a column which has a sql query in a tabular form

    Hi,
    I have a tabular form which contains a column named as SQL which has sql statements in it. Without going to the SQL workshop in Apex i want to execute that query in the tabular form itself. For that i've created a page item which fetches the particular rows sql query and created a button 'EXECUTE'. When i click the execute button it should run the query and should display whether the query is correct or not and should show the error message.
    Can any one provide solution for this or whether there are any other ways to achive this scenario.
    With Regards
    Balaji.P.K

    Balaji P.K wrote:
    Can any one provide solution for this or whether there are any other ways to achive this scenario.Difficult as we have no idea what this "scenario" actually is. Go back several steps and explain in detail the problem this is supposed to solve.
    I have a tabular form which contains a column named as SQLBad idea. <tt>SQL</tt> is a PL/SQL reserved word. Using any token from Oracle namespaces as a database identifier is confusing/problematic.
    which has sql statements in it.Why? Where does this SQL come from? What is the source of the tabular form?
    Without going to the SQL workshop in Apex i want to execute that query in the tabular form itself.Explain the "execute that query in the tabular form itself" concept. Where do the results go?

  • A Date prompt defaulting the data in Report based on selection

    Gurus,
    I have a requirement , where i have a (in between) date prompt set in the dashboard current defulting to Start Month date and End Month date of current month.
    What the user want is based on the selection using a drop down in dashboard which has got values Last Day, Last week, Last Month , the default values in Date filter should change in dashboard.
    For Eg. If the user select Last Week, the in between date filter show the default date value as Last Week Mon and Last Sun, and should filter out the report based on that.
    Any idea's are welcome....
    Thanks & Regards
    -Saurabh

    Try to see if you can get user to agree on something easier.
    Here are the steps to achieve what you want.
    1. Create a prompt for 1 day, 2 week, and 3 month
    2. Create three separate reports based on above selection, which has page prompt for day/week/month respectively.
    3. Create GN based on step in 1 and then let UI change between three reports you created in step 2
    I hope this helps,
    Best luck

  • How to query using CGI path for 'IN' sql statement

    Some problems that requires help:
    I have a report that requires a query which has 'IN' statement in SQL query. For example: SELECT EMP_ADDRESS1 FROM EMPLOYEE WHERE EMP_NO IN (:EMP_NO).
    I am going to query the result of this query using CGI. My peoblem starts here - I can't be passing a list of parameter for ':EMP_NO' because the path does not accept escape characters. I can't be put a query path below:
    <HTML>http://172.188.2.7/dev60cgi/rwcgi60.exe?server=9iAS&mode=default&destype=localfile&desformat=\\pri_wnt\generic&report=gcgd1.rdf&userid=comm/comm@employee<B>&emp_no='A','B','C'<B></HTML>
    What I am doing is that I will have a front end written in JAVA and display a listing of Employee available in the company. The user will be able to choose whatever employee on the front end. Then, I will call the CGI path to display the result to the user.
    Pls help. Kindly email personally([email protected]) or reply here.
    Thank you

    You'll need to escape your single quotes using %XX where XX is the hex code corresponding to the special character you want to use. I'm not sure what the escape code is for quotes. I know that if you wanted to have a space, this:
    ....../rwcgi60.exe?key+P_city='San Francisco'+....
    would need to look like:
    .../rwcgi60.exe?key+p_city=San%20Francisco+...
    You'll need to find out what the number for quote is. HOpe that helps a bit.
    Toby

  • Select in (select ...) (select main report based on child records)

    I have a Crystal Report XI rel 2 report but I need to narrow the search of the main report based on records in the child table.<br /><br />I have 3-tables and one report w/ a subreport.<br />The tables are locations, crashes, and vehicles.  The main report has the tables locations and crashes and the subreport has vehicles (one crash has 1 to n vehicles)<br /><br />How do I select records in the main report based on the child (see below SQL stmt.)<br />SELECT locations.county, locations.state, crashes.numpeople, crashes.time FROM locations,crashes<br />WHERE crashes.cid IN (SELECT cid FROM vehicles WHERE vehicles.vehicletype = &#39;Trailer&#39;);<br />

    Hi,
    Â You can use common shared variables to share data between a sub report and the main report.
    What Kathryn has suggested is correct but you must make sure that the sub report is run first and then the main report is executed.
    Â Hope this helps
    Â Cheers
    Â Sam

Maybe you are looking for