Question on using a Parameter against an Oracle date field

Post Author: klkemp100
CA Forum: Data Connectivity and SQL
newbie here just getting started in Crystal Reports v11.0
writing a report to go against an oracle view. i need the report to use a parameter that the user enters to select a specific date.
i went through the database expert and keyed in my own sql since i first tested this via TOAD and know that the sql works fine with a hard-coded date etc.
next i created a parameter and set it first up as a DATE but got the message that FAILED TO RETRIEVE DATA FROM THE DATABASE, even though I know that there is data to retrieve and i have previously retrieved it when the selection date is hard-coded in the query.
i then changed the field type in the view to be a VARCHAR2 and changed the parameter to be a STRING, but am still getting the same thing.
is there something special about using dates and parameters within crystal against oracle?
thanks in advance for your help.

Post Author: amr_foci
CA Forum: Data Connectivity and SQL
you also may check the date format , oracle maybe excpecting you to send the parameter in some format and you are sending it into another format
if both are type dates in report and database you can use this
where to_date(to_char(mytable.my_date_field,'dd/mm/yyyy'),'dd/mm/yyyy') = to_date(to_char(,'your_format'),'dd/mm/yyyy')
you may use this in a free hand SQL
good luck

Similar Messages

  • Can you use SQL Developer against non Oracle data bases?

    If so, then how do you define the connection for non Oracle data bases?

    Look, SQL Developer has got to be a 'gateway' into Oracle DBs from other databases. JDBC allows simple introspection and execution of SQL commands. So the 'explain' button won't be available, or some of the DDL stuff, big deal! Let them get a taste of what they are missing by not having an Oracle database.
    If we can get non-Oracle developers (especially MS SQL Server) to use SQL Developer it will expose them to the superiority of the Oracle DB server.
    If they have heterogenous services installed they are already an Oracle customer -- we have little additional DB server sale opportunity there. SQL Developer is a really sweet tool and it could be a real draw into the DB server sales.
    SQL Developer must be easily usable by non-Oracle customers in order to help us sell the DB server to them!

  • How to convert SAP dateTime field to Oracle date field

    Hi All,
                We have a scenario where the incoming data is in the following format:
    < ReconciliationData >
        < RowID > 9 </ RowID > 
        < Run_ID > 7 </ Run_ID > 
        < Control_ID > 5.40 </ Control_ID > 
        < Control_Name > MTD CHARGES TO CARP ORDERS INVENTORY </ Control_Name > 
        < Start_Month > 008 </ Start_Month > 
        < End_Month > 008 </ End_Month > 
    <b>   < SAP_Time > 20070828190545 </ SAP_Time > </b>
        < SAP_Count > 4 </ SAP_Count > 
        < SAP_Amount > 5000.00 </ SAP_Amount > 
        </ ReconciliationData >
    On the receiver side is oracle database. SAP TIME field has to go into Oracle Date field. it should be transformed to structure yyyy/mm/dd hh:mm:ss format.
    How do i go about doing it?
    Regards,
    XIer

    hey
    did u try the DateTrans function?if that does not work then u can write a simple UDF for it
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/frameset.htm
    Thanx
    Aamir

  • Problem with updating Time component of an Oracle Date field in ALBPM

    Hi.
    I'm new to ALBPM and am experiencing the following problem I hope someone can take the time to help out with.
    I'm using a Date and Time Picker element in a Form to enter the date and time information. Within ALBPM the date and time representation appears correct as it prints out what I've entered. The logMessage displays this information in the form "YYYY-MM-DD HH24:mm:ss+TimezoneOffset". The BPM Object that stores this value is referencing an Oracle table that has an equivalent Date field. My problem is that it appears to only update the Date component.
    I've also tried using the native Time variable type within ALBPM be adding an variable of type Time to the BPM Object and setting the result Database object equal to this Time variable with the same result. The Time variable was declared with Timestamp precision (take this to mean both Date and Time components).
    Has anyone come across this problem? I'm using ALBPM Studio 6.0 M3 as my release.
    Thanks.

    I must have deselected the "Use Timestamp for Date columns" in the Advanced tab within the External Resource definition for my database at some point in time. Enabling this option fixed my problem - silly me.

  • Oracle Date Field Exception

    When using the ODP.NET provider version 2.111.6.20 to access an Oracle 9i database we get errors with some date fields. We can read most records fine, however, on some records we get an exception "Year, Month, and Day parameters describe an un-representable DateTime"
    We get this error the second we try to access the field. It doesn't matter how we access it we still get the error.
    We are using an OracleDataReader object and have tried the following.
    object o = reader["FieldName"];
    object o = reader.GetValue(i);
    string s = reader.GetValue(i).ToString();
    string s = reader["FieldName"].ToString();
    Oracle.DataAccess.Types.OracleDate d = (Oracle.DataAccess.Types.OracleDate)reader;
    Oracle.DataAccess.Types.OracleDate d = reader.GetOracleDate(i); * This returns a different error. It says "ORA-1866: the datetime class is invalid"
    DateTime d = reader.GetDateTime(i);
    I'm pretty well stumped at this point. I can't get this record & field to do anything but throw an exception whenever accessed in .Net.
    However, if I query the table in Oracle SQL Developer it shows the value 31-DEC-01 for the field.
    Thanks for any assistance.

    Hi,
    My guess is you may have invalid data stored. Or, at least I'd check that.
    If you issue this query, does anything come back as 00-000-0000 00:00:00 ?
    select to_char(<columnname>,'dd-mm-yyyy hh24:mi:ss') from <tablename>;
    If you have access to Metalink the following note may help:
    Note 95402.1 - Baddate Script To Check Database For Corrupt dates
    Cheerrs
    Greg

  • EJB - Oracle Date Field

    hello
    how can i insert a date field into oracle table using EJB?
    now i'm using java.sql.Timestamp, but it's deprecated
    bye
    ACS

    Hi Antonio,
    Since when is java.sql.Timestamp deprecated?
    I am using OC4J version 1.0.2.2 with JDK 1.2.2 (that comes with 9iAS)
    and I use java.sql.Timestamp all the time in my applications without
    any problems. Here is an example using JDBC:
    java.sql.Timestamp timestamp = new java.sql.Timestamp(System.currentTimeMillis());
    Connection conn = DriverManager.getConnection();
    String sql = "UPDATE my_table SET my_date_col = ?";
    PreparedStatement ps = conn.prepareStatement(sql);
    ps.setTimestamp(1, timestamp);
    ps.executeUpdate();
    What am I missing?
    Good Luck,
    Avi.

  • SOA 11g DBAdapter Polling using a Sequencing Table with a DATE Field

    Hi.
    I have implemented a polling solution using a sequencing table that references a DATE column. For the most part the poll works correctly, but on occasion, I am not seeing a BPEL process instantiation for various records that get created in my source table.I have also noticed that in this particular case, the DATE field content on one or more source records is exactly the same --> "YYYYMMDDhhmmss".
    I just want to confirm here, that the polling adapter should be able to pick up multiple records from the source table, even though the date field is exactly the same. As well, how should I go about trying to debug this issue, if point #1 is handled by the system. Is there is a specific log or trace file that I can look at. Also, could I be facing a timing issue ?
    Can someone please comment on this.
    Thanks.

    In my table, I don't see a primary key, but only a unique index. I would assume then, that this would be analogous to the primary key capture; noticed that currently this code was only using one column out of two, from the unique index itself.
    Also, is the date content issue that I mentioned above a moot point then, based upon not having the correct primary key/unique key data pointers established ?
    Thanks.

  • Simple Question About Using "Group by" Inside the Oracle XE Query Builder

    Hi,
    I am a new user of Oracle 10g XE and I have built and populated some tables. I am trying to create a view (make a query) via using the Query Builder. I have chosen two attributes, say course_section_ID and trainer_ID in the same table. I choose the "COUNT" function for course_section_no and I check the box for "Group By" with trainer_ID. (I would like to count the number course sections each trainer is teaching). Then I "run" the query and the same error message appears:
    fail to parse SQL query:
    ORA-00904: "COURSE_SECTION"."TRAINER_ID": invalid identifier
    Both attribute names should be valid (as shown above).
    If I only choose course_section_ID and do a COUNT on it, it gives the same error message on course_section_no.
    I did try to do the same thing with the demo HR database. There were no problems with counting a field nor with grouping on a field with HR.
    PLEASE HELP!
    Thanks.

    I have got it. When all the attribute names are in the uppercase, then I can do aggregate functions and "group by" with the GUI.

  • How to use DB connect against secondary Oracle DB ?

    Hi all,
    this is the issue:
    an existing BI 7.0 based on Oracle 10.2.0.2.0 has to acquire data from an external Oracle 9.2.0.6 database. We want to use DB connect functionality.
    1st Q: are the existing components (DBSL and Oracle db-client) sufficient for interfacing to the secondary database?
    2nd Q: would it be better practice to look at the external database as a completely separate one? which means to install separate DBSL and db-client for it.
    Unfortunately neither online documentation nor SAP notes provide full clarification. Is there any experience in the field? all comments and contributions are warmly appreciated!
    THX, Harry

    Still puzzling on that issue. Will come back when completely solved. /hs
    OK, gurus, expertz and those to be, here's the story:
    BI 7.0 component of SCM-APO (Oracle 10.2.) is successfully connected to remote Oracle 9.2.
    Actually there have been just a couple of points to look after. First thing was to maintain the alias connection string in tnsnames.ora file. Plus this file is required twice, in the ORASID directory as well as in the <SID>ADM directory.
    Next issue is that apparently Oracle 'grants' are not supported by DB-Connect. But at least there is BI support package 11 which enables us to connect to other users' objects (different user than DB-Connect user). This healed the grants issue.
    Further topics have been the date conversion issue (this should already be done in the remote source DB) and name length and characters-2-B-used requirements.
    Once again thanks for your contributions and happy computing!
    Harry
    Message was edited by:
            Harald Schwenger

  • 3 range parameter query to Oracle data base from Excel 2000

    A user bas been trying to setup parameter queries into an Oracle
    DB. He normally used MS query and written VBA code to
    modify the query for daily or adhoc updates.
    With Excel 2000, he wanted to take advantage of parameter
    queries linked directly to cells in a spreadsheet.
    He was able to get single or two level parameter queries
    directly linked to the spreadsheet to run, however every time he
    went to a
    three level parameter query it crashed while returning the data
    to Excel.
    The error windows read: Microsoft Excel [Oracle][ODBC] with no
    other details.
    Is there a limit on the number of "levels" for parameter
    queries.
    The user was able to build and see the results of a three level
    query in MS Query, but every time he tried to return the data to
    Excel, it crashed.
    Jeff

    This is an Microsoft Access problem. When you initally connect
    to an ODBC source database Access caches the connection and does
    not ask for connection information on subsequent linked table
    accesses. This causes a problem if you request information from
    tables belonging to different users during the same Access
    session. The way to avoid this error happening is to create a
    user with access privileges to both users being used by the
    Access front end. When you connect to Oracle use the new user
    and you should be able to connect to all the linked tables. It
    may also be worth copying the Access databases to one single
    database and trying the migration that way.
    Regards
    Daniel

  • Questions on using a SOAP web service's data in a Crystal Reports report

    I'm attempting to create a report using CR 2008, accessing data from a SOAP web service. I've run into a few problems, and need some advice.
    1) CR doesn't seem to support WSDL files that use relative URI imports (for example, I have a relatively complicated WSDL file that imports other WSDL files and schemas using relative URI locations). To solve this problem, I have downloaded all of the files to my local hard drive, and changed the "location" attributes to point to local files. Is there any other solution to this problem?
    2) CR doesn't seem to support circular references within schema files. To solve this problem, I have removed circular references from my local schema files. Of course, my actual web service will still potentially return data structures with these circular dependencies. Is there any other solution to this problem?
    3) CR doesn't seem to support request documents that allow for arrays of elements. For example, my schema allows the user to specify an array of Instruments that should be returned by the web service. In the meantime, I have changed the schema to only specify single instances of the Instrument element in the request. Is there any other solution to this problem?
    4) CR doesn't seem to support empty values for optional attributes that are specified in the schema. So, when the "Enter Values" parameter form appears, I am required to enter values for these attributes, even though they are listed as optional in the schema. To avoid this problem, I have commented out the optional attribute values in the schema. Is there any other solution to this problem?
    5) When the schema specifies that a value is based on a restricted simple (string) type, the CR parameter form shows a drop list with ellipses (...), but the drop list does not contain the enumerated types specified in my schema. Instead, I must manually enter a value. Do you know of any reason why the drop list is not populated?
    6) The SOAP response document from my web service is relatively complicated. So, in the "Data" page of the Standard Report Creation Wizard, each and every XML element level of the response document listed in the schema is shown as a separate entry. If I choose just the top level element ("fetchInstrumentSetResponse"), then very little data is shown on the next page of the wizard (only the ID attribute). But, if I select each and every element type from the response document, CR prompts me for the request document parameters for each row I have selected (I see the same form 30+ times), even though there really should only be a single SOAP request to the web service to return this response document. It seems to be treating each of these elements as a separate "database table", with a different query string for each. Am I using this feature incorrectly?
    If you can point me to somewhere in the documentation that handles this in more detail, that would be great (all I could find were the step-by-step instructions on how to connect to a web service as a data source).
    Thanks!

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with your directly

  • Question about using MAX to get the lastest date.

    My question is I need to get the latest erstate.DATE_CREATED.
    I thought that I could just do the following max(erstate.DATE_CREATED) but get
    this error message (ora-00937: not a single-group group function). Can some explain to me what I am supposed to do. Thanks
    select     eractivity.er_case_id,
         erstate.description as latest_status,
         erstate.DATE_CREATED
    from      dpss_gdats.er_activity eractivity,
         dpss_gdats.er_state erstate
    where      eractivity.ER_STATE_ID = erstate.er_state_id
    and      eractivity.er_case_id = :p_case

    Yes max(erstate.DATE_CREATED) will get you the latest erstate.DATE_CREATED. Looking at your query I'm not really sure if you want the latest date for every case_id, description or you want the latest date_created period.
    If you want the former:
    select eractivity.er_case_id, erstate.description as latest_status,
    max(erstate.DATE_CREATED)
    from dpss_gdats.er_activity eractivity,
    dpss_gdats.er_state erstate
    where eractivity.ER_STATE_ID = erstate.er_state_id
    and eractivity.er_case_id = :p_case
    group by eractivity.er_case_id, erstate.description
    for the latter :
    select max(erstate.DATE_CREATED)
    from dpss_gdats.er_activity eractivity,
    dpss_gdats.er_state erstate
    where eractivity.ER_STATE_ID = erstate.er_state_id
    and eractivity.er_case_id = :p_case

  • Oracle date field not comparing properly with to_date function

    Hi, i'm facing a very weird problem. I'm triyng to retrieve a range of records in between two dates. However, it doesn't seem to understand. What am i doing wrong?
    let's say my table (MYRECORD) has this (where id is varchar and date is DATE and not timestamp) :
    ID DATE
    1 22-JAN-08
    2 22-JAN-08
    3 21-JAN-10
    4 11-FEB-10
    5 11-FEB-10
    So, let's say iwanna get the records from 21st Jan 2010 :
    select
    date as ori_date from MYRECORD where
    date = to_date('21/01/2010','DD/MM/YYYY')
    1.)
    it is not returning any record at all. I'm having problems with between dates and the to_date function as well,
    so i'm trying to get the 'equal' part working first. I can't use to_char because at the end of the day,
    i need to compare between dates.
    what am i doing wrong? has this got anything to do with what kind of format is set up on the oracle server?
    running :
    SELECT value FROM v$nls_parameters WHERE parameter ='NLS_DATE_FORMAT'
    returns DD-MON-RR
    2.) how do we compare dates from the table according to our own specified format from our passed string? I only have READONLY access to this database
    so i can't set anything up.

    please run this
    select To_date(date, 'DD/MM/YYYY HH24:MI:SS') as ori_date from MYRECORDprobably you have hour minute second info in your table, to_date('01012010','DDMMYYYY') means hour, minute and second is 00:00:00 so it wont be equal.The database field type is actually 'DATE' and not datetime. I've also ran the sql you provided to show its timestamp, but it's not showing anything as far as timestamp is concerned. It's showing only the date. So does this mean it's a real date only information?
    However, it might be more efficient to do two comparisons, especially if there's an index on dt:
    WHERE   dt >= TO_DATE ('21/01/2010', 'DD/MM/YYYY')
    AND     dt <  TO_DATE ('22/01/2010', 'DD/MM/YYYY')
    Ok. If we change the range to compare it on the same day, it won't work;
    WHERE   dt >= TO_DATE ('21/01/2010', 'DD/MM/YYYY')
    AND     dt <=  TO_DATE ('21/01/2010', 'DD/MM/YYYY')this also happens if we're using BETWEEN
    this is real weird. It's supposed to work...i don't recall having this kind of issue on other databases. If that's the case,
    each time a user passes me a date string i have to somehow add another day onto its 'to' comparison date in order for things to work.
    but..i don't want to since i don't want to accidentally include the extra day's results!
    Edited by: 803998 on Oct 21, 2010 8:14 PM
    Edited by: 803998 on Oct 21, 2010 8:33 PM

  • Query Parameter against a UDT

    Hello All:
       Normally when you do paramter like
    /*select from OINV t0*/
    declare @docdate as datetime
    /* where */
    set @docdate = /* t0.docdate */ '[%0]'
    select @docdate
    But I have tried to use a parameter against UDT instead of SBO native table.. I am not sure if this is doable...Has anyone done something like this before?
    /*select from dbo.[@JP_WHSPSR] t0*/
    declare @wareperson as nvarchar(50)
    /* where */
    set @wareperson = /* t0.Name */ N'[%0]'
    select @wareperson
    Anyone can help I greatly appreciate it!

    Hi, many thanks for responding. I want to do something like this
    /* Select from .[owht] T0 */
    declare @code as nvarchar(15)
    /* where  T0.U_TGV_CODE_JURIS ='902'*/
    set @code= /* T0.wtname */  '[%0]'
    select @code
    But the 'where' clause doesn´t filter the query I only want to select the name where de code is like '902' and not the rest. This brings me all what i have in the table

  • C++ Application and Oracle Data Source

    Hi everyone,
    I am a bit of a newbie in this domain so am a bit confused with some of the options I have for my task. My task is to have a C++ application which will write/read/update data to/from an Oracle database. What are my options in this case?
    I have read about OCI and OCCI, about ODBC drivers etc. but how does it fit in. If I use OCI or OCCI, do I need an ODBC driver (since from what I have seen, these aren't available for free and free is also one of the requirements)? If not, what do I need to be able to use OCI or OCCI?
    If I am wrong and there are free ODBC drivers for Linux, where can I find them?
    Or does this whole question sound like garbage? :(
    Thanks in advance.

    Hi,
    This is my experience, if you know for sure that your application is going to execute always against a Oracle Data source, perhaps you shouldn't use ODBC and you should go for OCCI. This should be a good starting point:
    http://www.orafaq.com/faq/oci
    And here is another question, how can I set up a development environment to compile a C++ application (written using ODBC) on a Solaris server? I need the headers and the library against which I have to link the application. My Oracle database is 9.2.0.4.0.
    Any help will be appreciated. Thanks!

Maybe you are looking for