Produce report NOT based on a single sql statement

I want to produce a tabular report based on a series of sql statments. Specifically, a report of managers that wil include counts of employees that are in other tables using differing criterias.
Name Count Count
using using
criteria 1 criteria 2
Manager1 35 242
I would expect to write an anonymous pl/sql block with a driving cursor determining the managers to report on. Within that cursor, I would execute a number of other queries to derive the count for each of the two columns.
I have tried creating a report region based on a sql statement, but that requires a single sql statement. I also tried creating a report region based on plsql, but it required an into statement of defined items. This option looks like it can provide multiple rows, but since it selected 'INTO' named fields, it only creates a report with the last row of data.
I must be missing something. Any suggestions are greatly appreciated!!!

If you want a wizard to create the form and report for you then yes you need to have a table. One thing that you can do is define a view that contains the data you need and define an Instead Of trigger on that view so the automatic fetch and dml will work but you can have the data stored into the different objects. basically the view and the trigger work as a router/dispatcher for the data.
*edit*
I should also add that you can write a pl/sql package which does the fetch and the dml operations with the form items as input. This is the solution I would typically use for any form that was not a simple CRUD form for a table. One thing to note is for the fetch I prefer to use out parameters for the form items so it requires the developer to map the item to the param in the app so it will show up when you are searching through the app. I highly discourage hiding item references inside of packaged code.
Good Luck!
Tyson
Message was edited by: TysonJouglet

Similar Messages

  • Is it possible creating a report not based on a table?

    In APEX I've always created form on report so as to have the list of records of a table and the possibility of inserting/updating every sinle record by means of the form on it, ok?
    I have an application concerning classic costumers, orders, ... with a table for every item.
    The problem is that I have to gather all information ao as to produce a classic bill with a typical layout where you have on your left some descriptions and on your right an amount but of course the layout is not based on a classic table, do you mean?
    Do I have to create a table in which I'll add data and null values so as to get the layout desired (basically a work-around solution) or is there a better way to do it?
    Thanks!

    If you want a wizard to create the form and report for you then yes you need to have a table. One thing that you can do is define a view that contains the data you need and define an Instead Of trigger on that view so the automatic fetch and dml will work but you can have the data stored into the different objects. basically the view and the trigger work as a router/dispatcher for the data.
    *edit*
    I should also add that you can write a pl/sql package which does the fetch and the dml operations with the form items as input. This is the solution I would typically use for any form that was not a simple CRUD form for a table. One thing to note is for the fetch I prefer to use out parameters for the form items so it requires the developer to map the item to the param in the app so it will show up when you are searching through the app. I highly discourage hiding item references inside of packaged code.
    Good Luck!
    Tyson
    Message was edited by: TysonJouglet

  • Single SQL statement that does multiple column checks

    I have multiple sql statements (see below) that do value and format checking on different columns within the same table. I am trying to condense these checks into one SQL statement, anyone know how to do this?
    select colx, coly, col1 from table1 where col1 not in ('A','B','C')
    select colx, coly, col2 from table1 where col2 not in ('X','Y','Z')
    etc
    Note that I am looking for the value of the offending column (e,g col1 or col2) as the last of the three columns outputted,
    Thanks in advance

    Perhaps;
    SQL> create table t (colx number, coly number, col1 varchar2(1),
       col2 varchar2(1), col3 varchar2(1), col4 varchar2(1))
    Table created.
    SQL> insert all
       into t values(1,1,'A','D','G','J')
       into t values(1,2,'*','D','G','J')
       into t values(1,3,'A','D','G','J')
       into t values(1,4,'A','*','G','J')
       into t values(1,5,'A','D','G','J')
       into t values(1,6,'A','D','*','J')
       into t values(1,7,'A','D','G','J')
       into t values(1,8,'_','-','/','*')
    select * from dual
    8 rows created.
    SQL> select colx, coly,
       trim(regexp_replace('Col1' || col1,'(Col1)([^A|B|C])|(Col1)([A|B|C])', '\1 ') ||
            regexp_replace('Col2' || col2,'(Col2)([^D|E|F])|(Col2)([D|E|F])', '\1 ') ||
            regexp_replace('Col3' || col3,'(Col3)([^G|H|I])|(Col3)([G|H|I])', '\1 ') ||
            regexp_replace('Col4' || col4,'(Col4)([^J|K|L])|(Col4)([J|K|L])', '\1')) offending_column,
       trim(regexp_replace(col1,'([^A|B|C])|([A|B|C])', '\1 ') ||
            regexp_replace(col2,'([^D|E|F])|([D|E|F])', '\1 ') ||
            regexp_replace(col3,'([^G|H|I])|([G|H|I])', '\1 ') ||
            regexp_replace(col4,'([^J|K|L])|([J|K|L])', '\1')) offending_value
    from t
    where regexp_replace(col1||col2||col3||col4,
          '(A|B|C)(D|E|F)(G|H|I)(J|K|L)') is not null
          COLX       COLY OFFENDING_COLUMN     OFFENDING_VALUE    
             1          2 Col1                 *                  
             1          4 Col2                 *                  
             1          6 Col3                 *                  
             1          8 Col1 Col2 Col3 Col4  _ - / *            
    4 rows selected.Message was edited by:
    MScallion
    Added offending_value
    NOTE* this query only works on single character columns and requires modification for multi character columns

  • How to run a single sql statement

    I want to run a simple sql statement to get some data in my Controller or AM.
    Is there some way, other than creating a VO with the SQL statement, to get some data from the database. My sql query will always return a single row.

    Hi,
    here you have an example I use to call a function in a package (note how you can pass parameters and read results):
    Connection conn = this.getOADBTransaction().getJdbcConnection();
    OracleCallableStatement ocs = null;
    String param = null;
    try {
            String stmt = "BEGIN :1 := <PkgName>.<FunctionName>(:2); end;";
            ocs = (OracleCallableStatement)conn.prepareCall(stmt);
            ocs.registerOutParameter(1, OracleTypes.CHAR);
            ocs.setString(2, <param>);
            ocs.execute();
            param = ocs.getString(1);
         } catch(SQLException se) {
             throw OAException.wrapperException(se);
         finally {
             try {
                    ocs.close();
                    return(param);
             } catch(Exception e) {
                    throw OAException.wrapperException(e);
         }Hope this helps you
    Bye
    Raffy

  • Not able to View generated SQL statement

    Hi,
    In order to view the generated SQL statement in Receiver JDBC Adapter,
    i have done logSQLStatement as true in  CC still not able to view in RWB,
    also mesg protocol i m using in CC is "xml sql format", is it bcos of this i am not able to ?
    If yes, then how can i see that sql string?
    Regards,
    Pratibha

    Pratibha,
    In our JDBC scenario the message protocol is also set to XML SQL Format
    The Integration Process has a mapping step of type XSL that uses an Imported Archive to create the SQL select statement.  Then there is a synchronous Send step for the JDBC component
    Both this SQL statement and the returned SQL result are available in the XML message monitor SXMB_MONI
    Regards,
    Mike

  • BIDS 2008 DataFlow viewer not showing even though the sql statement returns data

    Have a dataflow and trying to see why no rows are being written to the destination.  I popped a viewer on the connection, but it doesnt show up when I run.  What can I check?
    The DataFlow source runs a sql statement and it runs fine and returns a result.

    Why would that be if I can execute the sql statement that is being used in the OLEDB Source, and I get a result, yet the destination gets no rows afterwards.  Even executing the Dataflow task by itself, no rows are written.
    I do have a script task that modifies the connection before the dataflow, but this was working fine yesterday :)
    Even so, if there was a problem with the connection, I would get an error.  There no no errors, it just sees no rows and the dataviewer is never displayed.
    What the heck can I check?

  • Producing report sections based on data with previous sections

    I'm designing a event tracking report where you provide the event number to the report through a parameter, which then gets the corresponding event data.
    This then has to use the previous event number that was retrieved by said event number to get the next lot of event data and so on until it reaches a event that has a previous event number of 'NA' meaning no more events.
    So my question is how can i achieve this within crystal reports?
    I was using a parameter that could hold the multiple event numbers that resulted from a tracking search with in visual basic, and that worked fine, but i now realize that with another report that i have to produce with multiple starting events that all have to be tracked in the one report.
    For this i was just going to use a sub report within the details section but because i don't know how many sub reports would have to be produced i can't allow for enough parameters to pass the list of events in the way i was previously doing it, thus i have to let the report do the tracking for me.
    Google hasn't returned anything that would provide a solution to this problem, so any help would be gladly recieved

    I have decided to use a dataset for this where i populate it with all the events with all their traces and give each set of traced events a number, then in crystal load this dataset and group by the trace number and sort my the event number to get them in order.
    This should give me the required output, but I'm having trouble implementing the dataset with crystal reports, i have maked a strongly typed dataset and populated it with columns, then get all the data for the traces and add that to a dataset using the strongly typed dataset as a template.
    Then create the report as an object and assign the report source as the dataset and pass it to the crystal report viewer
    Unfortunately this does not have any resulting data produced on the crystal report
      Dim objRpt = New Trace_Report
            objRpt.SetDataSource(Plant_Report_Data)
            With Trace_Report__Form
                .CrystalReportViewer1.ParameterFieldInfo = paramFields
                .CrystalReportViewer1.ReportSource = objRpt
                .WindowState = FormWindowState.Maximized
                .ShowDialog()
            End With
    Any ideas?

  • Crystal report not able to see a SQL view in Business One

    Hi all
    I am trying to create a report using views I have created in the Business One database.
    I can run the report fine when using the Crystal Designer, but when I try to Preview the external Crystal report file from within Business One, it comes up with an error 'The table 'xxxx' can not be found'.
    I have tried to make the connect an SAP Business One connection, and also tried it with the OLEDB connection.  Neither worked.
    (I can however preview other 'table' reports fine)
    I am running SAP B1 8.8 SP 0 pl 15 and SQL2005.
    As views are allowable in B1 databases I would hope that we can use them in our Crystal reports.  Can we use views?
    Or is it my setup/Crystal setup that is causing me issues.
    Any help much appreciated.
    Thanks
    Denise

    Hi Gordon and Kevin
    Thank you both for your replies.
    Gordon - great idea to use the Command mechanism. I had not thought of that but will give that a try.
    Kevin - pleased to hear views are allowed as I often use them in my reports.
    I think I have a more basic issue with my setup of Crystal & B1 on the system - and perhaps this is causing my inability to use views. 
    My current approach is to install Crystal Designer on the server.  I know that it is preferable to put the designer elsewhere but I am not able to connect using SAP Business One connection at all from the client machines.  Frustration! (Keeps saying Logon failed and I KNOW I have the correct logon details)
    Will update this thread once I have set up the designer on the server and hopefully succeeded in including a view (or command) in a report.
    Thanks for your help
    Denise

  • SQL Report not showing data - available in SQL Workshop and SQL Developer

    I am having an issue with developing a SQL Report in APEX 3.2.1. I run the code in both SQL developer and SQL Workshop and I get data pulled back (both against my development environment). When I run the same code in a SQL Report region, it returns no data available. Does anyone have any idea what would be causing this? Other regions on the page accessing different tables in the same schema return data without issue. Any help would be appreciated.
    Thanks
    Freddie

    Could you explain the last comment a bit more. Here is a bit more info just in case I touch on the info with it. The db schema is BPAMGR, the Workspace is BPAMGR. We use the same schema for all of our reporting. All of our tables are in the same schema. We don't use any tables outside of this schema. Our APEX workspace has been associated to only this schema. The tables are able to be queried by SQL Workshop in the same APEX instance that the report application is under.
    Freddie

  • Access two DB in single SQL statement

    I need to insert rows from a table on one DB into a table on a second DB (residing on a separate server). Is that possible?

    lujate wrote:
    I have a table on one DB that needs to periodically be copied to a second DB. The DB's are from different vendors, running on different OS's.Stating it again...this has nothing to do with java.
    Either the database does it or it doesn't. If it does then you use that functionality (of the database, not java). It if doesn't then your stated requirement (one statement) will not work.
    Let me provide you and example that seems like it should work but in fact will not.
    You can use the MS Access GUI to set up an ODBC connection to anything that you have a ODBC driver for - so say Oracle.
    Once you have that then it would appear that you could set up structures that makes it look like an oracle table exists in MS Access.
    One problem - that is a trick of the GUI. It will not work with JDBC because the GUI does that and not the MS Access "database".
    I think you can do something similar with MS SQL Server. In that case it really does exist in the database. So you could call it from JDBC.

  • SSRS report not displaying data in correct order

    Guys,
    I have a SSRS 2012 report not displaying returned records from SQL in the correct order.  Running the stored procedure in SSMS and supplying the parameter values returns the data correctly and running Query Designer in SSRS using the stored procedure
    on the dataset in question, likewise returns the data correctly.  Only when I run the actual report does the data display incorrectly(always last name order).  I've done similar reporting using very similar stored procedures and I've never had this
    problem.  Below is the stored procedure.  "@SortBy" is the parameter with the sorting value. 1=Due Date; 2=Denial Amt and 3=Last name and is passed by SSRS to SQL.  Wish I could supply screen shots.  
    Thanks for any help,
    Dave
    ALTER PROCEDURE [dbo].[RAC_PT_List]
    @Level as int,
    @SortBy as int,
    @PTLName as varchar(30) = NULL,
    @User as varchar(10) = NULL
    AS
    SELECT pat.headerID,
    pat.PT_LName + ', ' + pat.PT_FName AS PTName,
    pat.PT_AcctNo,
    rco.RCO_CLMREF,
    rco.RCO_AppealLevel,
    rco.RCO_LevelNo,
    rco.RCO_AuditorStatus,
    let.LET_DEN_DueDate,
    CONVERT(varchar(12),let.LET_DEN_DueDate) as DueDate,
    let.LET_DEN_Dollars,
    let.userID
    FROM Master_PT_List pat
    INNER JOIN Master_RCO_Work rco on RCO.PT_headerID = pat.headerID
    INNER JOIN Master_Letters let on LET.PT_headerID = pat.headerID
    WHERE (@PTLName IS NULL OR(pat.PT_LName LIKE + '%' + @PTLName + '%'))
    AND (rco.RCO_LevelNo = @Level)
    AND (let.userID = @User)
    --AND (rco.RCO_AuditorStatus <> 'Closed' and rco.RCO_AdminStatus <> 'Closed')
    ORDER BY 
    CASE WHEN @SortBy = '1' THEN LET_DEN_DueDate
    END
    DESC,
    CASE WHEN @SortBy = '2' THEN let.LET_DEN_Dollars
    END
    DESC,
    CASE WHEN @SortBy = '3' THEN pat.PT_LName
    END

    Hi DaveMac1960,
    According to your description, when you render data in report, you find it always shows the data with unexpected order. Right?
    In Reporting Services, if we don't set any sorting in tablix, it will order the data as your query in SSMS or Query Builder. In some scenario, for example, we add parent group for data rows, it will have the rows sort by the group on data field by default,
    and the "order by" in your query will be ignored. So please check the Sorting tab in Tablix Properties, in this scenario, we suggest you delete any sorting in the Sorting tab so that the "Order By" clause can work.
    Reference:
    Sort Data in a Data Region (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Problem with empty report parameters when passed to PL/SQL function

    Hi,
    We have come across what appears to be a bug in the JRC. When passing a report parameter to a PL/SQL function as a parameter, empty parameters are changed before being sent to the function. More specifically, an empty string "" ends up as the value "(')" in the PL/SQL function parameter. In our report we print the report parameters on the first page so we know that the parameters are OK before being passed to the database.
    The problem exists for version 12.2.203, 12.2.204 and 12.2.205 of the JRC.
    We have identified a workaround, but it is not exactly elegant: Before executing the report we modify all empty  parameters ("") to " " . In the PL/SQL function, we trim all parameters before using them.
    We call the function using a command object with a sql syntax like this example:
    select * from table (qa_batch_release.get_qa_br('{?p_report_id}','{?p_reg_set_number}','{?p_cr_number}','{?p_change_id_decode}','{?p_country_id}','{?p_mfg_item_no}','{?p_4_no}','{?p_5_no}','{?p_7_no}'))
    The PL/SQL function is a table returning function.
    Best regards, Thor

    Hi Kishore,
    using #COLUMN_VALUE# would probably not make much sense, because normally a report has multiple columns and not just the numeric column which you want to verify if it's negative. But APEX will fire the template condition for each column, because the report template is a column cell template.
    What you can do to make it more generic is to use for example
    #CHECK_AMOUNT#
    in the template and provide a not displayed column in your SQL statement which contains your value which is named CHECK_AMOUNT. For example:
    SELECT NAME
         , BALANCE
         , BALANCE AS CHECK_AMOUNT
    FROM XXX;Because this CHECK_AMOUNT column would be a generic name, you can use this template in all your reports as long as you provide this column.
    Thope that helps
    Patrick

  • How to generate multiple records on a single sql from dual table

    I wanted to generate ten sequence nos in a single sql statement from dual table.
    Is there any way to use that.
    I think somebody can help me on this by using level clause

    I'm not 100% sure if I understand your requirement: Do you really want to use an Oracle Sequence, as Alex already demonstrated?
    Or just a 'one-time-bunch-of-sequential-numbers'.
    In the latter case you can just select level:
    SQL> select level
      2  from   dual
      3  connect by level <= 10;
         LEVEL
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    10 rows selected.

  • How to SUM two count(*) values in a single sql tatement?

    How can I get a single SQL statement to sum two values from a count(*)
    I want something like this:
    SELECT COUNT(*) FROM MYTABLE
    UNION
    SELECT COUNT(*) FROM MYOTHERTABLE;
    but instead of getting
    111
    222
    I want to see the sum of the two values.
    333can such a thing be done with one statement. I know I can do stuff inside a BEGIN END and have vars but wonder if there is simple single statement solution.
    Thanks in advance,
    David Miller

    SQL> select count(*) from user_indexes;
                COUNT(*)
                      30
    SQL> select count(*) from user_tables;
                COUNT(*)
                      43
    SQL> select (select count(*) from user_indexes) + (select count(*) from user_tables)
      2  from dual;
    (SELECTCOUNT(*)FROMUSER_INDEXES)+(SELECTCOUNT(*)FROMUSER_TABLES)
                                                                  73

  • Multiple SQLs INSERT in a single SQL with O.Lite on PDA

    Hi,
    We are using(and new to) Oracle on PDA, dvlping in JAVA. We need to increase performance and reliability to make multiple INSERT in a single SQL statement, dynamically created :
    We've got a syntax error when executing this :
    INSERT INTO t1 (row1,row2) VALUES ('x','y');
    INSERT INTO t1 (row1,row2) VALUES ('a','v');
    INSERT INTO t1 (row1,row2) VALUES ('e','r');
    etc... in a single execSql
    Any suggests would be helpfull !
    JMarc
    [email protected]

    Hi Praveen
    If your use case is like having large no. of data rows and inserting those into DB. I believe best appropriate way would be form a xml and then pass it to DB. While in DB, you can create SP and perform your logical steps(if any) thereafter inserting data into table.
    The above link shared by Muzammil talks on the same subject.
    While once within SP(DB layer), you can fetch entire xml using below example:
    DECLARE @data XML;
    -- Element-centered XML
    SET @data = '<data>
        <customer>
          <id>1</id>
          <name>Name 1 </name>
        </customer>
        <customer>
          <id>2</id>
          <name>Name 2</name>
        </customer>
         <customer>
          <id>3</id>
          <name>Name 3</name>
        </customer>  
        </data>';
    SELECT T.customer.value('(id)[1]', 'INT') AS customer_id,
           T.customer.value('(name)[1]', 'VARCHAR(20)') AS customer_name
    FROM @data.nodes('data/customer') AS T(customer);
    The above run will give you output from xml in single shot.
    You can also find maximum no. of rows as below.
    declare @max int
    select @max = @data.value('fn:count(/data/customer/id)','int')
    select @max  
    I believe above should help you around with your insertion...

Maybe you are looking for

  • IPod and Windows connection

    I installed the software on my laptop and when I was instructed to restart my computer I did so. I then encountered a problem because my computer would not reboot. It got 9 thenths of the way there but then it locked up. My iPod continuously flashed

  • ITunes Causing My Mac to Grind to a Halt

    Hello, I was looking for some help.  A couple of weeks ago I did a wireless syce with my iPod Touch.  I accidentlaly forgot about it and removed without properly ejecting.  I notice the next day that with iTunes open on my Mac, everything was running

  • Plot chart problem

    Hi experts,     In plotchart using cirlcular item renderer am getting full details.But instead of that one using customItemRenderer am unable to get full details.This is my customItemRender(CirlceFileRenderer ) action script class file package     im

  • ITunes 11 crash on Windows 7

    Hello, since the update of iTunes to v.11. my iTunes is crashing sporadic after between 1 min and 60 min. I get the follow message in the Windows Event log for Applications: Protokollname: Application Quelle:        Application Error Datum:         0

  • Using Premiere Pro 6 - Capturing HDV .mpegs - These can't be seen by other programs like Compressor?

    I'm using XHA1's using a Canon HV20 to capture via FW to my IMAC with 10.7. I'm using Premiere Pro 6 and have been using Plural Eyes to do audio sync for the past year. About 6 months ago when I upgraded to Plural Eyes 3 (which they don't support vid