DB Adapter Custom Select SQL with Timestamps

Hi,
I am facing an issue with the DB Adapter Custom select sql: here is my scenario:
I am trying to select diff records from the database between user input start time & the sysdate. for this i am trying to use Execute Pure SQL option database adapter.
I am framing the SQL as below:
select  * from tablename1,tablename2 where tablename1.id = tablename1.id  and column1 like #userinput1 and tablename1.request_timestamp between to_date(#Userinput_requestTime) and sysdate
My question is whether the query
tablename1.request_timestamp between to_date(#Userinput_requestTime) and sysdate
is correct or not? I even given a try to_date(#Userinput_requestTime,'DD-MON-YY HH24:mi:ss') and sysdate 
that too not worked ,
I have created OSB business service using the generated adapter and the input i am giving it as '04-MAR-15 03.36.23.368179000 PM -06:00' and the input is of type xs:string .
i am getting errors like java.sql.SQLDataException: ORA-01830: date format picture ends before converting entire input string
Whether my custom sql is correct or not ? please help me in resolving this issue.
THanks,
SV

if
tablename1.request_timestamp
is timestamp then you need to compare as
timestamp beetween timestamp and timestamp
so convert date to timestamp by CAST as example
check How to convert DATE to TIMESTAMP

Similar Messages

  • Problem with PNP customized selection screen

    Hi guys,
    I have done a report in R/3 system using logical database PNP with customized selection screen. i have 3 parameters as below:
    1. radiobutton1 group a for current period,
    2. radiobutton2 group a for other period.
    3. personnel number.
    my program works fine in R/3 but not in my portal. i think it couldn't recognize my radiobutton in my customized screen. whichever radiobutton i selected also it would return current month records.
    any idea how to fix this?
    any configuration that i can do?
    thanks.

    try testing it through ITS first.
    in order to do so . Go to sicf transaction and run webgui. Then run the application using the tcode. Check the results.
    Seems wrong paramter are getting passed to the SAP system.
    Your ITS server should be activated first in order to use webgui otherwise you will be getting dump.
    Regards
    Atul Shrivastava

  • Problems with customizing select lists and popup LOVs

    Hi
    I have 2 problems about select lists and popup LOVs.
    The first one is about a select list in a tabular form.
    It should be created with APEX_ITEM.SELECT_LIST_FROM_LOV or similar and take its values from a named LOV.
    This worked fine but now it should also have the possibility to enter a free value.
    I tried to accomplish that by creating a APEX_ITEM.POPUP_FROM_LOV, but there is a problem with the function that is called by the arrow icon right to the input field (for eg. genList_f11_5()).
    If the row is added by addRow, then it works fine, but if the row is is not empty
    then the function call is like genList_f11_$_row() and the input field gets no value, when a LOV option is selected.
    The other problem is about a select list which should have the possibility to enter a custom value and
    also there should be the possibility to select several values. I tried to implement this by a text area containing the selected values and a multiple select list, with an event handler in each option. The user could click options and they would be copied to the text area. The problem is that I couldn't make the event handler work in IE.
    I would appreciate any ideas about either of these problems.
    Tiina

    Hi,
    If you download application you can see source.
    I have not write any instructions, sorry.
    If you are on Apex 4 you can just load jQuery UI autocomplete library and take ideas from my app.
    If you download my sample in zip there is uncompressed htmldbQuery library.
    You can see that and take only function htmldbAutocomplete.
    Then check jQuery UI document
    http://jqueryui.com/demos/autocomplete/#method-search
    There is method search that you can use open list just by click of input.
    I hope this helps at start.
    Regards,
    Jari

  • SQL help: Selecting tickets with no open tasks

    Hi Gurus,
    I'm new to SQL. I need your help in a script where I need to fetch the tickets with no open tasks.
    Say, following is the Task table
    Table: Task
    | ticketid | taskid | taskstatus |
    | 1 | 1 | O |
    | 1 | 2 | O |
    | 1 | 3 | O |
    | 2 | 4 | C |
    | 2 | 5 | C |
    | 3 | 6 | C |
    | 3 | 7 | O |
    The query should return the ticketid(s) with all its taskstatus = 'C'.
    Any help would be highly appreciated.
    Thanks

    Hi Surya,
    Here's an Oracle style example (Sorry, I just can't do that ansi stuff)
    SQL> with ticket as (select 1 ticketid, 'C' reason from dual union all
                    select 2 ticketid, 'O' reason from dual union all
                    select 3 ticketid, 'O' reason from dual union all
                    select 4 ticketid, 'C' reason from dual)
    ,taskstatus as (select 1 taskstatusid, 'O' taskstatus from dual union all
                    select 2 taskstatusid, 'C' taskstatus from dual union all
                    select 3 taskstatusid, 'P' taskstatus from dual union all
                    select 4 taskstatusid, 'F' taskstatus from dual union all
                    select 5 taskstatusid, 'O' taskstatus from dual union all
                    select 6 taskstatusid, 'C' taskstatus from dual union all
                    select 7 taskstatusid, 'P' taskstatus from dual union all
                    select 8 taskstatusid, 'F' taskstatus from dual)
          ,task as (select 1 ticketid,  1 taskid, 2 taskstatusid from dual union all
                    select 1 ticketid,  2 taskid, 3 taskstatusid from dual union all
                    select 1 ticketid,  3 taskid, 4 taskstatusid from dual union all
                    select 1 ticketid,  4 taskid, 4 taskstatusid from dual union all
                    select 2 ticketid,  5 taskid, 1 taskstatusid from dual union all
                    select 2 ticketid,  6 taskid, 1 taskstatusid from dual union all
                    select 2 ticketid,  7 taskid, 1 taskstatusid from dual union all
                    select 3 ticketid,  8 taskid, 2 taskstatusid from dual union all
                    select 3 ticketid,  9 taskid, 2 taskstatusid from dual union all
                    select 3 ticketid, 10 taskid, 6 taskstatusid from dual union all
                    select 4 ticketid, 11 taskid, 2 taskstatusid from dual union all
                    select 4 ticketid, 12 taskid, 6 taskstatusid from dual union all
                    select 4 ticketid, 13 taskid, 4 taskstatusid from dual union all
                    select 4 ticketid, 14 taskid, 8 taskstatusid from dual)
    select a.ticketid, c.taskstatus
      from  task a, ticket b, taskstatus c
    where a.ticketid = b.ticketid
       and c.taskstatusid = a.taskstatusid
       and (c.taskstatus = 'C' or c.taskstatus = 'F')
       and b.reason = 'C'     
       and not exists (select null
                         from task a1, taskstatus c1
                        where a1.ticketid = a.ticketid
                          and c1.taskstatusid = a1.taskstatusid
                          and (c1.taskstatus = 'O' or c1.taskstatus = 'P'))
    order by 1,2
      TICKETID T
             4 C
             4 C
             4 F
             4 F
    4 rows selected.Please note, how I made test data, that way is much more helpful than your tables
    Regards
    Peter

  • Select not working with Timestamp

    Hi all
    I am badly stuck with a problem related to Date-Time.I have easily inserted a record in oracle DB with date time,so I used Timestamp.Problem comes if I retrieve the record with Timestamp again.I don't know where I am wrong.FYI I used preparedStatement.setTimestamp().
    On other hand,just for testing, if I add the record with date only then I am able to get the record back using preparedStatement.setDate().But I want the solution with time.
    Is there anyone to raise hand?
    For more,the data type is Date in Oracle.I checked the long value of time before inserting & retrieving record is same
    Thanks in advance

    In your example, what type of object is myDate?
    BTW: I almost always use TO_DATE with my PreparedStatements, but your right you don't and shouldn't have to. Looks like this:
    SELECT * FROM MYTABLE WHERE COLDATE = TO_DATE(?,'YYYY-MM-DD HH24:MI:SS')
    Then I would use a
    setString(1,'2003-11-01 23:59:59')
    This method is certainly not portable but it has always worked for me. However, it is probably more appropriate to use setTimeStamp.

  • How to custom select minimum amount of addons and plugins to load with Firefox browser?

    Hello, I am using latest Firefox 24.0 along with Window xp service pack 3, with approx 1 1/2 Gb memory along with Firemin Plugin to keep Firefox Memory up. I will hopefully be upgrading my PC by early next year.
    However even when using Firemin along with Firefox, many times regular Firefox is bloated, and still uses too much memory, so, many times I have to open Firefox in Safe Mode, just to be lighter.
    Is there any way to open Full Version of Firefox, in a Custom select mode, where I can have set just the minimum Addons and plugins actually needed at the time, without having to go thru and disable the ones do not need? I wish I could use Firefox in safe mode all the time, because is so much lighter, but sometimes I just need the full feature version. Please advise, and thanks for your help!

    You can use multiple profiles and the -no-remote command line instance
    to load different (clean vs addon bloated) profiles.
    SEE
    * http://kb.mozillazine.org/Command_line_arguments
    AND
    * [[Use the Profile Manager to create and remove Firefox profiles]]

  • Problem with timestamp in query

    I have problem with timestamp in JPA query.
    I wonna select all data from database where difference between two timestamps is more than 3 month.
    Database:
    ID timestamp1 timestamp2
    1 20008-11-19 15:02000 20008-08-19 15:02000
    2 20008-11-19 15:02000 20008-11-14 15:02000
    @Column(name = "timestamp1", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date timestamp1;
    @Column(name = "timestamp2", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date timestamp2;
    sql query works:
    select id from table where
    MONTH( DATE(timestamp1) - DATE(timestamp2) ) > 3
    but how I can write in Java?
    I't doesnt wrk:
    Query query = em.createQuery("SELECT f.id FROM Foo f WHERE MONTH( DATE(f.timestamp1) - DATE(f.timestamp2) ) > 3 ")
    error:
    ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method .
    Exception data: <openjpa-1.0.2-r420667:627158 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter 'SELECT f.id FROM Foo f WHERE MONTH( DATE(f.timestamp1) - DATE(f.timestamp2) ) > 3'.
    Error message: <openjpa-1.0.2-r420667:627158 nonfatal user error> org.apache.openjpa.kernel.jpql.ParseException: Encountered "MONTH (" at character 438, but expected: ["(", "+", "-", ".", ":", "", "=", "?", "ABS", "ALL", "AND", "ANY", "AS", "ASC", "AVG", "BETWEEN", "BOTH", "BY", "CONCAT", "COUNT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "DELETE", "DESC", "DISTINCT", "EMPTY", "ESCAPE", "EXISTS", "FETCH", "FROM", "GROUP", "HAVING", "IN", "INNER", "IS", "JOIN", "LEADING", "LEFT", "LENGTH", "LIKE", "LOCATE", "LOWER", "MAX", "MEMBER", "MIN", "MOD", "NEW", "NOT", "NULL", "OBJECT", "OF", "OR", "ORDER", "OUTER", "SELECT", "SET", "SIZE", "SOME", "SQRT", "SUBSTRING", "SUM", "TRAILING", "TRIM", "UPDATE", "UPPER", "WHERE", <BOOLEAN_LITERAL>, <DECIMAL_LITERAL>, <IDENTIFIER>, <INTEGER_LITERAL>, <STRING_LITERAL>].
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(JPQLExpressionBuilder.java:1665)
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.<init>(JPQLExpressionBuilder.java:1645)

    The error is indocating improper formatting of your JPQL string. MONTH is not understood. I would recommend using your SQL string in a createNativeQuery(...) call instead.
    Doug

  • Using a custom PL/SQL to populate the primary key in a tabular form

    I want to use a Custom PL/SQL Function to populate the primary key when I insert a new record into a tabular form. I want to get the value from a hidden page Item. The code I am using for the primary key source is:
    BEGIN
    INSERT INTO TEAM_MEMBERS(TEAM_ID)
    VALUES(:P75_TEAM_ID);
    END;
    When I try to insert a new record I get the following error:
    Error      ERR-1904 Unable to compute item default: type = Function Body computation_type= BEGIN INSERT INTO TEAM_MEMBERS(TEAM_ID) VALUES(:P75_TEAM_ID); END; .
    ORA-06550: line 5, column 2: PLS-00103: Encountered the symbol ";" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe The symbol "exit" was substit
    Any ideas what I am doing wrong?
    Thanks!

    Brian - Sometimes whitespace at the end of the block causes this. Be sure to trim everything after the last semicolon including tabs and newlines.
    Scott

  • Custom PL/SQL API that inserts the data into a custom interface table.

    We are developing a custom Web ADI integrator for importing suppliers into Oracle.
    The Web ADI interface is a custom PL/SQL API that inserts the data into a custom interface table. We have defined the content, uploader and an importer. The importer is again a custom PL/SQL API that will process the records inserted into the custom table and updates the STATUS column of the custom interface table. We want to show the status column back on the spreadsheet.
    Defined the 'Document Row' import rule and added the rows that would identify the unique record.
    Errored row import rule, we are using a SELECT * from custom_table where status<>'Success' and vendor_name=$param$.vendor_name
    The source of this parameter is import.vendor_name
    We have also defined an Error lookup.
    After the above setup is completed, we invoke the create document and click on Oracle->Upload.
    The records are getting imported, but the importer program is failing with An error has occurred while running an API import. The ERRORED_ROWS step 20003:ER_500141, parameter number 1 must contain the value BIND in attribute 1.'

    The same issue.
    Need help.
    Also checked bne.log, no additional information.
    <bne:document xmlns:bne="http://www.oracle.com/bne">
    <bne:message bne:type="DATA" bne:text="BNE_VALID_ROW_COUNT" bne:value="11" />
    <bne:message bne:type="DATA" bne:text="BNE_INVALID_ROW_COUNT" bne:value="0" />
    <bne:message bne:type="ERROR" bne:text="An error has occurred while running an API import"
    bne:cause="The ERRORED_ROWS step 20003:ER_500165, parameter number 1 must contain the value BIND in attribute 1."
    bne:action="" bne:source="BneAPIImporter" >
    <bne:context bne:collection="collection_1" />
    </bne:message><bne:message bne:type="STATUS"
    bne:text="No rows uploaded" bne:value="" >
    <bne:context bne:collection="collection_1" /></bne:message>
    <bne:message bne:type="STATUS" bne:text="0 rows were invalid" bne:value="" >
    <bne:context bne:collection="collection_1" /></bne:message></bne:document>

  • JDBC Receiver Adapter -- Synch Select. ERROR

    Hello,
    We have implemented the scenario described by Bhavesh Kantilal in blog 3928:
    JDBC Receiver Adapter -- Synchronous Select – Step by Step 
    /people/bhavesh.kantilal/blog/2006/07/03/jdbc-receiver-adapter--synchronous-select-150-step-by-step
    but modified to our requirements.
    An Idoc is coming in, mapped to a sync receiver jdbc as described to collect data from a jdbc table.
    Result when connecting the oracle database with the jdbc receiver adapter:
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'T_ST_MAINDRIVER' (structure 'STATEMENT'): java.sql.SQLException: ORA-00942: table or view does not exist
    Oh, like to complete the information by the payload from the jdbc rec. connect:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_JDBC_LOOPUP_ID xmlns:ns0="http://www.xxx.org/excel">
    - <STATEMENT>
    - <TABLENAME ACTION="SELECT">
      <TABLE>T_ST_MAINDRIVER</TABLE>
      <ACCESS />
    - <KEY>
      <MAINDRIVER compareOperation="=">Optomechanical</MAINDRIVER>
      </KEY>
      </TABLENAME>
      </STATEMENT>
      </ns0:MT_JDBC_LOOPUP_ID>
    The table exists on the database. So, what is our mistake? Do you have any ideas?
    Best regards
    Dirk
    Message was edited by:
            Dirk Meinhard
    Message was edited by:
            Dirk Meinhard

    Hi Anil,
    I am back on my JDBC problem and I am one step further!
    Thank you for this hint. Looks like this is the solution.
    So I like to add my next question !
    My new error is resulting from my query command.
    I have set "=" to find a specific entry as compare operation.
    Error when executing statement for table/stored proc. 'IRIS.T_ST_MAINDRIVER' (structure 'STATEMENT'): java.sql.SQLException: FATAL ERROR document format in structure 'TABLENAME': unexpected value '=' for attribute 'compare' found
    Looks like this is not ok .
    This is my xml of this query:
    <ns0:MT_JDBC_LOOPUP_ID xmlns:ns0="http://www.xxx.org/excel">
       <STATEMENT>
          <TABLENAME ACTION="SELECT">
             <TABLE>IRIS.T_ST_MAINDRIVER</TABLE>
             <ACCESS/>
             <KEY>
                <MAINDRIVER compareOperation="=">Optomechanical</MAINDRIVER>
             </KEY>
          </TABLENAME>
       </STATEMENT>
    </ns0:MT_JDBC_LOOPUP_ID>
    Can you, or anybody else, give the helping idea?
    regards
    Dirk

  • How do I save browser and download history with timestamps?

    I want to be able to have access to and be able to export all my browser and download history on Firefox with timestamps. From the looks of it, Firefox doesn't place permanent time-stamps on browser history, and begins removing download data from the main download window after it reaches a certain volume. I'm mainly interested in knowing whether I can retrieve and export history and/or download data which is months old for forensic reasons. Basically, I just want to have a day-by-day breakdown of the sites I visited over the last year on Firefox instead of a month-by-month one and '6 months or older' pile.
    It would be nice if someone could clarify whether or not Firefox supports or can be made to support any of this, and if months-old browser history still has original time data associated with it that I can use to categorize it day-by-day.

    You can open the downloads.sqlite file in a program or extension that can handle SQLite database files.
    * SQLite Manager: https://addons.mozilla.org/firefox/addon/sqlite-manager/
    # Open Profile Directory -> XXX.sqlite -> Go
    # Hit the Execute SQL tab
    # Use a Select like this:
    <pre><nowiki>SELECT datetime(startTime/1000000,'unixepoch') AS startTime,name,source AS url,target,currBytes AS bytes,((endTime-startTime)/1e6) AS time,currBytes/((endTime-startTime)/1e6) AS speed,mimeType
    FROM moz_downloads
    ORDER By startTime DESC
    </nowiki></pre>
    If you need more (or less) data then add open the XXX table to see the names of the available columns and add them to (or remove them from) the SELECT line separated by commas.

  • Problem with Timestamp

    Hi
    I am using Oracle 10.1.0.4. When I am storing events with the received
    timestamps, it stores in GMT. But I am calling the stored procedure
    with timestamp in IST. Similarly when I search for that using IST, It
    returns the results matching the corresponding GMT. If I search 6.30 AM
    IST, It returns results for 1.00 AM.
    Appreciate your help

    What kind of timestamp datatype?
    How are timestamps "received" and stored?
    Time zone settings (sessions and database)?
    SQL> drop table tider;
    Table dropped.
    SQL> create table tider (t1 timestamp with time zone, t2 timestamp with local time zone);
    Table created.
    SQL> select sessiontimezone from dual;
    SESSIONTIMEZONE
    -05:00
    SQL> insert into tider values ('1-jul-6 1:0:0 pm','1-jul-6 1:0:0 pm');
    1 row created.
    SQL> select * from tider;
    T1
    T2
    01-JUL-06 01.00.00.000000 PM -05:00
    01-JUL-06 01.00.00.000000 PM
    SQL> alter session set time_zone='Europe/Stockholm';
    Session altered.
    SQL> select * from tider where t1='1-jul-6 8:0:0 pm CET';
    T1
    T2
    01-JUL-06 01.00.00.000000 PM -05:00
    01-JUL-06 08.00.00.000000 PM
    Is this same as what you are seeing?

  • Calling custom pl/sql package on termination of Employee

    Hi,
    I want to call a custom pl/sql package that will create an element entry for employees, with their outstanding holiday entitlement upon termination.
    One way I have tried to do this is by personalizing the end employment form, but I get this error - ORA-00923: FROM keyword not found where expected
    from this code:
    <h5> ='declare
    l_element_entry_id NUMBER;
    l_object_version_number NUMBER;
    l_create_warning BOOLEAN;
    begin
    pay_element_entry_api.create_element_entry(p_validate => FALSE
    ,p_effective_date => (${item.period_of_service.actual_termination_date.value})
    ,p_business_group_id => 106
    ,p_assignment_id => (select assignment_id from per_all_assignments_f where person_id = ${item.period_of_service.person_id}
    and primary_flag = 'Y')
    ,p_element_link_id => 3499
    ,p_entry_type => 'E'
    ,p_input_value_id1 => 7318
    ,p_entry_value1 => (XX_PERSNS_UTILS.GetLeaveAccrual(${item.period_of_service.person_id}))
    --,p_cost_allocation_keyflex_id => ee_asg_api_rec.cost_allocation_keyflex_id
    ,p_effective_start_date => ((${item.period_of_service.actual_termination_date.value})-1)
    ,p_effective_end_date => ${item.period_of_service.actual_termination_date.value}
    ,p_element_entry_id => l_element_entry_id
    ,p_object_version_number => l_object_version_number
    ,p_create_warning => l_create_warning
    end'
    </h5>
    I also thought another way to accomplish this would be using business events but under Workflow Administrator I can see the Business Events and subscriptions but I can only search for existing set-up, I can't create my own.
    Does anyone have any ideas why this personalisation isn't working or has any other ideas of how to go about this?
    Thanks

    This is a tough solution to implement. The drawbacks of Forms Personalization, if you get it working, are that it won't be called from other areas (People Management templates, Self Service Termination etc). The drawbacks of API User Hooks are that they're not used in all places either. Finally, as mentioned, reverse termination means that you need to then backout such holiday payout entries.
    The most reliable way to do this is with an batch process, eg, concurrent program, that runs, say, daily:
    1) Find all employees physically terminated yesterday (regardless of their actual termination date)
    2) Calculate and create the holiday payout entry (if it's not already there)
    3) Find all employees who were updated yesterday and HAVE the holiday payout entry (this is the way to detect those who have been reverse terminated)
    4) Date-track purge the holiday payout entry.
    5) Consider API User Hooks to pick up late changes to absence records or anything that might affect any holiday already paid out so that you can update the holiday payout entry
    6) Configure retro to handle holiday payout for retrospective terminations, deductions for those who were paid holiday payout and later reverse terminated, and subsequent changes to the amount paid out (eg, because of late changes to absence records)

  • Retrieve SQL with filters applied from an Interactive Report

    I want to use an Interactive report as interface for providing parameters to a base report query.
    I would like to capture the full SQL code from the filtered interactive report and then run the sql to create a collection.
    I have found this tread
    Re: Using Data from filtered Interactive Report
    which says that you can use APEX_APPLICATION_PAGE_IR to access the reports SQL. This holds the information about the interactive report when the user saves it. The sql code from the interactive report (after the user has added filters) is stored in the field sql_query.I can only retrieve the base query and not the filtered version even after saving.
    Any ideas how this can be done would be appreciated.
    regards
    PP

    OK Darren I think I've got it working. My solution is an adaption that follows the steps of a blog I found here: http://stewstools.wordpress.com/2009/02/19/get-ir-where-clause/
    My solution allows you to click on a button and the records that are currently displayed in the IR report are saved to an APEX collection. You can then use the collection to save records to a table or run a report on another page. (I haven't included code for this last step but it's easy to find on the forum)
    First a bit of background knowledge. The following APEX views hold all the information on IRs that you access via PLSQL code in the package you need to download. Run an IR report, save a version of the report, then in SQL Workshop have a look at:
    select * from APEX_APPLICATION_PAGE_IR
    select * from APEX_APPLICATION_PAGE_IR_COND
    select * from APEX_APPLICATION_PAGE_IR_COL
    select * from APEX_APPLICATION_PAGE_IR_RPT
    When you run an IR report it has an internal ID that you can access and also a Base Id for each Saved report that is currently in context.
    Here are the steps:
    1) Download the following package and install it in the workspace schema
    http://www.mediafire.com/?nj118x9vmc9
    click on the link "click here to download"
    2)In the HTML header Attribute of the page where your IR runs, put the following Javascript:
    <!--===================================================================-->
    <!--FUNCTION TO RETRIEVE IR REPORTS SQL WITH WHERE CLAUSE
    <!--===================================================================-->
    <script language="JavaScript" type="text/javascript">
    function SaveAndRunReport() {
    document.location='f?p=&APP_ID.:3:&SESSION.:CONSTRUCT_IR_QUERY:NO::'+
    'P3_BASE_REPORT_ID:'+$v('apexir_REPORT_ID');
    </script>
    <!--===================================================================-->
    Notes: You will need to obviously change the URL above to reflect your Page No. (3) and the name of a HIDDEN Item (P3_BASE_REPORT_ID) that you will populate with the base ID of the report.
    Setting :P3_BASE_REPORT_ID to +$v('apexir_REPORT_ID') is an internal thing and works out of the box. It returns the Id of the Base report.
    3) Create a button called SELECT_SPECIMENS (in region position - top of region) in the IR region that will initiate the execution of the IR background SQL to create a collection with the current selected records.
    TARGET= URL
    URL Target = javascript:SaveAndRunReport();
    You might also want to create a condition that only shows the button when there are records selected
    CONDITION TYPE=Exists(SQL returns at least one row)
    EXPRESSION 1 - put the SQL of the IR report here.
    4)Create a branch back to the same page (3) and with the REQUEST attribute set to the value in the Javascript URL above e.g. CONSTRUCT_IR_QUERY. Create a condition on the branch that uses this branch WHEN BUTTON PRESSED= SELECT_SPECIMENS
    5) Create an AFTER HEADER PROCESS with the following code:
    declare
    v_base_query clob;
    v_where clob;
    v_query clob;
    v_base_where varchar2(12):=' where 1=1 '; -- incase there is no where clause in the base query
    begin
    if apex_collection.collection_exists('IR_COLLECTION') THEN
    htmldb_collection.delete_collection( p_collection_name => 'IR_COLLECTION');
    end if;
    --GET THE BASE QUERY OF THE IR REPORT
    select sql_query
    into v_base_query
    from APEX_APPLICATION_PAGE_IR
    where application_id=:APP_ID
    and page_id=:APP_PAGE_ID; -- you can only have one IR report per page
    --UNCOMMENT TO VIEW THE PARAMETERS TO THE PACKAGED FUNCTION
    --raise_application_error(-20001, :APP_ID||'-'||:APP_PAGE_ID||'-'||:SESSION||'-'||:P3_BASE_REPORT_ID);
    --GET THE SQL FILTER CODE
    select apex_ir_query.ir_query_where(:APP_ID,:APP_PAGE_ID,:SESSION,:P3_BASE_REPORT_ID)
    into v_where
    from dual;
    --CHECK TO SEE THAT THERE IS A "WHERE" CLAUSE IN THE BASE QUERY
    if instr(upper(v_base_query),'WHERE ') > 0 then
    v_query:=v_base_query||' '||v_where;
    else
    v_query:=v_base_query||' '||v_base_where||' '||v_where;
    end if;
    --UNCOMMENT TO SEE THE FULL QUERY SYNTAX
    --raise_application_error(-20001,v_query);
    --CREATE COLLECTION FROM IR RECORDS
    apex_collection.create_collection_from_query(P_collection_name=>'IR_COLLECTION',p_query=>v_query);
    exception
    when others then
    raise_application_error(-20001, 'Interactive report not found. Contact Administrator. Could not create collection of records.');
    end;
    remember to update P3_BASE_REPORT_ID above to your HIDDEN ITEM name.
    Set the following attributes for the process above
    CONDITIONAL PROCESSING
    CONDITION TYPE = Request=Expression 1
    EXPRESSION 1 --> CONSTRUCT_IR_QUERY (Note: this was set on the branch in step 4 above)
    6) Run the IR report, click on the "SELECT SPECIMENS" button then click on the Session link on the Developer's Toolbar and select VIEW COLLECTIONS from the popup list then click GO. You should now see the IR records.
    By the way I've been testing in IE not Firefox.
    ...and that's it!
    enjoy
    Paul P

  • How to insert date with timestamp into table values

    hi,
    I have a table
    create table abc1(dob date);
    insert into abc1 values (to_date(sysdate,'RRRR/MM/DD HH24:MI:SS'))
    but when i see in data base it shows as normal date without time stamp.
    Is it possible to insert into back end with timestamp.
    Thanks..

    First, SYSDATE is a DATE already, no need to convert it to a DATE using the TO_DATE() function.
    The date ALWAYS has a time component, whether or not it is displayed is up to your NLS settings. for example:
    SQL> CREATE TABLE ABC1(DOB DATE);
    Table created.
    SQL> ALTER SESSION SET NLS_DATE_FORMAT='MM/DD/YYYY';
    Session altered.
    SQL> INSERT INTO ABC1 VALUES(SYSDATE);
    1 row created.
    SQL> SELECT * FROM ABC1;
    DOB
    02/04/2010
    SQL> ALTER SESSION SET NLS_DATE_FORMAT='MM/DD/YYYY HH24:MI:SS';
    Session altered.
    SQL> SELECT * FROM ABC1;
    DOB
    02/04/2010 12:54:57
    SQL> DROP TABLE ABC1;
    Table dropped.

Maybe you are looking for

  • Matching FI Line Items and Total Records for FM

    Dear Friends, Currently, we are implementing Public Sector Management using Former Budgeting. Some PR and PO has been created, before the FM budget data transferred from Cost Center Planning using FM9C. Using FMRP_2FMB4002 report, the u2018Available

  • Questions on Room State

    Hey guys,      I got some questions on room state:      1) Does the room state actually take some effect or just an indicating flag? For example, if a room state is ROOM_STATE_ENDED, will it prevent any incoming user connection?      2) I tried to lo

  • HDTV connection using vga---- compositve

    Hi. I recently bought the mini-dvi to vga converter for my macbook to connect it to my television, and it works great. I just bought another HDTV however, and it does not have a vga input. After some research, I'd like to set up a connection between

  • Learner access in different level

    Dear We are on 11.5.10. I have defined course OAF TRAINING and selected "human resource" as organization for learner, while offering i defined and the same function "learner" menu appearing. However, in offering i select 'Finance deparment' for learn

  • Single drum sound

    Hi, I'm new to Garage Band and am having some trouble. I'm am trying to create a simple rhythm, in 3/4 time, C major, and 108 bpm. The only instrument I want is a snare drum. I add a software instrument track and select Drum kits > Rock kit. I put al