Wrong cardinality with date literal

Hi guys,
There is table T with column D (DATE). The table consists of data from 1999 year.
NUM_ROWS = 33.7M
The column D does NOT have histogram.
There is index on the column D (and columns C1, C2).
create index ... on T (D, C1, C2)There is a SQL and plan
SQL> explain plan for
  2  select *
  3    from t
  4   where t.D > to_date('01.01.2010', 'dd.mm.rrrr')
  5  ;
Explained
SQL> @plan
Session altered
Plan hash value: 2411994532
| Id  | Operation                   | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT            |                       |     1 |   278 |     5   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| T                     |     1 |   278 |     5   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | D                     |     1 |       |     4   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - access("T"."D">TO_DATE(' 2010-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
14 rows selectedNotice, cardinality = 1 (!!!) Why?
When min data is 1999 year, and max is 2010 year in the SQL above I expect get cardinality about 1/10 of NUM_ROWS.
But cardinality = 1.
This is the question.
As I know (68992.1), in this case selectivity is calculate as 1 - (High - Value / High - Low). But in my 10053 trace I see very small value 1.6733e-08.
SINGLE TABLE ACCESS PATH
  BEGIN Single Table Cardinality Estimation
  Column (#25): D(DATE)
    AvgLen: 8.00 NDV: 7765172 Nulls: 0 Density: 1.2878e-07 Min: 2451269 Max: 2453250
  Using prorated density: 1.6733e-08 of col #25 as selectivity of out-of-range value pred
  Table: T  Alias: T    
    Card: Original: 29880736  Rounded: 1  Computed: 0.50  Non Adjusted: 0.50
  END   Single Table Cardinality Estimation
  Access Path: TableScan
    Cost:  785120.33  Resp: 785120.33  Degree: 0
      Cost_io: 572319.00  Cost_cpu: 57593829444
      Resp_io: 572319.00  Resp_cpu: 57593829444
  Using prorated density: 1.6733e-08 of col #25 as selectivity of out-of-range value pred
  Using prorated density: 1.6733e-08 of col #25 as selectivity of out-of-range value pred
  Access Path: index (RangeScan)
    Index: TIDX
    resc_io: 5.00  resc_cpu: 31164
    ix_sel: 1.6733e-08  ix_sel_with_filters: 1.6733e-08
    Cost: 5.12  Resp: 5.12  Degree: 1And the second one - how can I translate HIGH_VALUE and LOW_VALUE from dba_tab_col_statistics from RAW to DATE?

793769 wrote:
SINGLE TABLE ACCESS PATH
BEGIN Single Table Cardinality Estimation
Column (#25): D(DATE)
AvgLen: 8.00 NDV: 7765172 Nulls: 0 Density: 1.2878e-07 Min: 2451269 Max: 2453250
Using prorated density: 1.6733e-08 of col #25 as selectivity of out-of-range value predAnd the second one - how can I translate HIGH_VALUE and LOW_VALUE from dba_tab_col_statistics from RAW to DATE?I know you've said that the question is answered - but
a) The "out of range value" is a good clue that the low/high values are not what you expect
b) For dates, the values are the Julian format of the date, and in your case we see:
SQL> select to_char(to_date('01.01.2010','dd.mm.rrrr'),'J') from dual;
TO_CHAR
2455198
1 row selected.Your high value is well below 1st Jan 2010.
The value you have can be derived from :
SQL> select to_char(to_date('2453250','J'),'dd-mon-yyyy') from dual;
TO_CHAR(TO_
01-sep-2004
1 row selected.Regards
Jonathan Lewis

Similar Messages

  • What wrong with date ?

    I have a field, type date and some records with date : 14-nov-2005,
    My problem is when I run the sql, the record did not show up,
    SELECT ORDNUM,TO_CHAR(OREG_PRN_DT,'DD-MON-YYYY') FROM ORDER_H
    WHERE OREG_PRN_DT='14-NOV-2005'
    result---------
    no rows selected
    BUT
    SELECT ORDNUM,TO_CHAR(OREG_PRN_DT,'DD-MON-YYYY') FROM ORDER_H
    WHERE TO_CHAR(OREG_PRN_DT,'DD-MON-YYYY')='14-NOV-2005'
    --result
    ORDNUM TO_CHAR(ORE
    54360 14-NOV-2005
    53106 14-NOV-2005
    2 rows selected.
    What wrong ???? anybody can help ?
    Actually I have another date, but everything is ok, accept 14-nov-2005.
    Thank

    Yet again, I took too long putting an example together! :-)
    Anyway, might as well post it....
    Hello
    it must be the season for date issues! :-)
    Anyway, the first part of the problem is that in your first query, optimiser to convert the string '14-NOV-2005' into a date as can be seen with the following test:
    SQL> create table dt_test_date (dt date)
      2  /
    Table created.
    SQL> insert into dt_test_date values(sysdate)
      2  /
    1 row created.
    SQL> insert into dt_test_date values(sysdate + 1)
      2  /
    1 row created.
    SQL> select * from dt_test_date
      2  /
    DT
    03-AUG-06
    04-AUG-06
    SQL> select * from dt_test_date where dt=sysdate
      2  /
    no rows selected
    SQL> select * from dt_test_date where dt='03-AUG-06'
      2  /
    no rows selected
    SQL> select * from dt_test_date where TO_CHAR(dt,'DD-MON-YY')='03-AUG-06'
      2  /
    DT
    03-AUG-06
    SQL> select * from dt_test_date where dt='03-AUG-0612121'
      2  /
    select * from dt_test_date where dt='03-AUG-0612121'
    ERROR at line 1:
    ORA-01830: date format picture ends before converting entire input string
    SQL> select * from dt_test_date where dt=TO_DATE('03-AUG-06','DD-MON-YY')
      2  /
    no rows selectedThe second part of the problem is that the date column in your table will contain a time as well as the date:
    SQL> alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS'
      2  /
    Session altered.
    SQL> select * from dt_test_date
      2  /
    DT
    03-AUG-2006 16:50:00
    04-AUG-2006 16:50:08Which means that you either have to specify the time portion, eliminate it from consideration using TRUNC, or set up a date range to search over that goes from 00:00:00 to 23:59:59 - the last is my prefered option:
    SQL> SELECT
      2     *
      3  FROM
      4     dt_test_date
      5  WHERE
      6     dt >= TO_DATE('03-AUG-2006 00:00:00','DD-MON-YYYY HH24:MI:SS')
      7  AND
      8     dt <= TO_DATE('03-AUG-2006 23:59:59','DD-MON-YYYY HH24:MI:SS')
      9  /
    DT
    03-AUG-2006 16:50:00Which means that because oracle automatically sets the time portion to midnight when it is not specified, you can simplify this to be:
    SQL> SELECT
      2     *
      3  FROM
      4     dt_test_date
      5  WHERE
      6     dt >= TO_DATE('03-AUG-2006','DD-MON-YYYY')
      7  AND
      8     dt < TO_DATE('03-AUG-2006','DD-MON-YYYY') + 1
      9  /
    DT
    03-AUG-2006 16:50:00
    SQL> SELECT
      2     dt,
      3     TO_DATE('03-AUG-2006','DD-MON-YYYY'),
      4     TO_DATE('03-AUG-2006','DD-MON-YYYY') + 1
      5  FROM
      6     dt_test_date
      7  WHERE
      8     dt >= TO_DATE('03-AUG-2006','DD-MON-YYYY')
      9  AND
    10     dt < TO_DATE('03-AUG-2006','DD-MON-YYYY') + 1
    11  /
    DT                   TO_DATE('03-AUG-2006 TO_DATE('03-AUG-2006
    03-AUG-2006 16:50:00 03-AUG-2006 00:00:00 04-AUG-2006 00:00:00
         HTH
    David

  • Wrong cardinality estimate for range scan

    select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - ProductionSQL : select * from GC_FULFILLMENT_ITEMS where MARKETPLACE_ID=:b1 and GC_FULFILLMENT_STATUS_ID=:b2;
    Plan
    | Id  | Operation                   | Name                        | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                             |   474K|    99M|   102  (85)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| GC_FULFILLMENT_ITEMS        |   474K|    99M|   102  (85)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | I_GCFI_GCFS_ID_SDOC_MKTPLID |   474K|       |    91  (95)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("GC_FULFILLMENT_STATUS_ID"=TO_NUMBER(:B2) AND "MARKETPLACE_ID"=TO_NUMBER(:B1))
           filter("MARKETPLACE_ID"=TO_NUMBER(:B1))If i use literals than CBO uses cardinality =1 (I believe this is due it fix control :5483301 which i set to off In my environment)
    select * from GC_FULFILLMENT_ITEMS where MARKETPLACE_ID=5 and GC_FULFILLMENT_STATUS_ID=2;
    | Id  | Operation                   | Name                        | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                             |     1 |   220 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| GC_FULFILLMENT_ITEMS        |     1 |   220 |     3   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | I_GCFI_GCFS_ID_SDOC_MKTPLID |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("GC_FULFILLMENT_STATUS_ID"=2 AND "MARKETPLACE_ID"=5)
           filter("MARKETPLACE_ID"=5)Here is column distribution and histogram information
    Enter value for column_name: MARKETPLACE_ID
    COLUMN_NAME          ENDPOINT_VALUE CUMMULATIVE_FREQUENCY  FREQUENCY ENDPOINT_ACTUAL_VALU
    MARKETPLACE_ID                    1                     1          1
    MARKETPLACE_ID                    3                  8548       8547
    MARKETPLACE_ID                    4                 15608       7060
    MARKETPLACE_ID                    5                 16385        777   --->
    MARKETPLACE_ID                35691                 16398         13
    MARKETPLACE_ID                44551                 16407          9
    6 rows selected.
    Enter value for column_name: GC_FULFILLMENT_STATUS_ID
    COLUMN_NAME                    ENDPOINT_VALUE CUMMULATIVE_FREQUENCY  FREQUENCY ENDPOINT_ACTUAL_VALU
    GC_FULFILLMENT_STATUS_ID                    5                 19602      19602
    GC_FULFILLMENT_STATUS_ID                    6                 19612         10
    GC_FULFILLMENT_STATUS_ID                    8                 19802        190
    3 rows selected.
    Actual distribution
    select MARKETPLACE_ID,count(*) from GC_FULFILLMENT_ITEMS group by MARKETPLACE_ID order by 1;
    MARKETPLACE_ID   COUNT(*)
                 1       2099
                 3   16339936
                 4   13358682
                 5    1471839   --->
             35691      33623
             44551      19881
             78931      40273
            101611          1
                      6309408
    9 rows selected.
    BHAVIK_DBA: GC1EU> select GC_FULFILLMENT_STATUS_ID,count(*) from GC_FULFILLMENT_ITEMS group by GC_FULFILLMENT_STATUS_ID order by 1;
    GC_FULFILLMENT_STATUS_ID   COUNT(*)
                           1        880
                           2         63   --->
                           3         24
                           5   37226908
                           6      22099
                           7         18
                           8     325409
                           9        343
    8 rows selected.10053 trace
      SINGLE TABLE ACCESS PATH
      Table: GC_FULFILLMENT_ITEMS  Alias: GC_FULFILLMENT_ITEMS
        Card: Original: 36703588.000000  Rounded: 474909  Computed: 474909.06  Non Adjusted: 474909.06
      Best:: AccessPath: IndexRange
      Index: I_GCFI_GCFS_ID_SDOC_MKTPLID
             Cost: 102.05  Degree: 1  Resp: 102.05  Card: 474909.06  Bytes: 0
      Outline Data:
      /*+
        BEGIN_OUTLINE_DATA
          IGNORE_OPTIM_EMBEDDED_HINTS
          OPTIMIZER_FEATURES_ENABLE('11.2.0.2')
          DB_VERSION('11.2.0.2')
          OPT_PARAM('_b_tree_bitmap_plans' 'false')
          OPT_PARAM('_optim_peek_user_binds' 'false')
          OPT_PARAM('_fix_control' '5483301:0')
          ALL_ROWS
          OUTLINE_LEAF(@"SEL$F5BB74E1")
          MERGE(@"SEL$2")
          OUTLINE(@"SEL$1")
          OUTLINE(@"SEL$2")
          INDEX_RS_ASC(@"SEL$F5BB74E1" "GC_FULFILLMENT_ITEMS"@"SEL$2" ("GC_FULFILLMENT_ITEMS"."GC_FULFILLMENT_STATUS_ID" "GC_FULFILLMENT_ITEMS"."SHIP_DELIVERY_OPTION_CODE" "GC_FULFILLMENT_ITEMS"."MARKETPLACE_ID"))
        END_OUTLINE_DATA
      */Is there any reason why CBO is using card=474909.06 ? Having fix control () in place, it should have set card=1 if it is considering GC_FULFILLMENT_STATUS_ID= 2 as "rare" value..isn't it ?

    OraDBA02 wrote:
    You are right Charles.
    I was reading one of your blog and saw that.
    As you said, it is an issue with SQLPLUS.
    However, plan for the sql which is comming from application still shows the same (wrong cardinality) plan. It does not have TO_NUMBER function because of the reason that it does not experience data-type conversion that SQLPLUS has.
    But YES...Plan is exactly the same with/without NO_NUMBER.OraDBA02,
    I believe that some of the other people responding to this thread might have already described why the execution plan in the library cache is the same plan that you are seeing. One of the goals of using bind variables in SQL statements is to reduce the number of time consuming (and resource intensive) hard parses. That also means that a second goal is to share the same execution plan for future executions of the same SQL statement, even through bind variable values have changed. The catch here is that bind variable peeking, introduced with Oracle Database 9.0.1 (may be disabled by modifying a hidden parameter), helps the optimizer select the "best" (lowest calculated cost) execution plan for those specific bind variable values - the same plan may not be the "best" execution plan for other sets of bind variable values on future executions.
    Histograms on one or more of the columns in the WHERE clause could either help or hinder the situation further. It might further help the first execution, but might further hinder future executions with different bind variable values. Oracle Database 11.1 introduced something called adaptive cursor sharing (and 11.2 introduced cardinality feedback) that in theory addresses issues where the execution plan should change for later executions with different bind variable values (but the SQL statement must execute poorly at least once).
    There might be multiple child cursors in the library cache for the same SQL statement, each potentially with a different execution plan. I suggest finding the SQL_ID of the SQL statement that the application is submitting (you can do this by checking V$SQL or V$SQLAREA). Once you have the SQL_ID, go back to the SQL statement that I suggested for displaying the execution plan:
    SELECT * FROM TABLE (DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'TYPICAL'));The first NULL in the above SQL statement is where you would specify the SQL_ID. If you leave the second NULL in place, the above SQL statement will retrieve the execution plan for all child cursors with that SQL_ID.
    For instance, if the SQL_ID was 75chksrfa5fbt, you would execute the following:
    SELECT * FROM TABLE (DBMS_XPLAN.DISPLAY_CURSOR('75chksrfa5fbt',NULL,'TYPICAL'));Usually, you can take it a step further to see the bind variables that were used during the optimization phase. To do that, you would add the +PEEKED_BINDS format parameter:
    SELECT * FROM TABLE (DBMS_XPLAN.DISPLAY_CURSOR('75chksrfa5fbt',NULL,'TYPICAL +PEEKED_BINDS'));Note that there are various optimizer parameters that affect the optimizer's decisions, for instance, maybe the optimizer mode is set to FIRST_ROWS. Also possibly helpful is the +OUTLINE format parameter that might provide a clue regarding the value of some of the parameters affecting the optimizer.  The SQL statement that you would then enter is similar to the following:
    SELECT * FROM TABLE (DBMS_XPLAN.DISPLAY_CURSOR('75chksrfa5fbt',NULL,'TYPICAL +PEEKED_BINDS +OUTLINE'));Additional information might be helpful. Please see the following two forum threads to see what kind of information you should gather:
    When your query takes too long… : When your query takes too long ...
    How to post a SQL statement tuning request: HOW TO: Post a SQL statement tuning request - template posting
    Charles Hooper
    http://hoopercharles.wordpress.com/
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Having a problem with dates when I send my numbers doc to excel. dates are all out and that they have to cut and paste individual entries onto their spreadsheet. Any idea how I can prevent this

    having a problem with dates when I send my numbers doc to excel. dates are all out and that they have to cut and paste individual entries onto their spreadsheet. Any idea how I can prevent this.
    I'm using Lion on an MBP and Numbers is the latest version

    May you give more details about what is wrong with your dates ?
    M…oSoft products aren't allowed on my machines but I use LibreOffice which is a clone of Office.
    When I export from Numbers to Excel and open the result with LibreOffice, the dates are correctly treated.
    To be precise, dates after 01/01/1904 are correctly treated. dates before 01/01/1904 are exported as strings but, as it's flagged during the export process, it's not surprising.
    Yvan KOENIG (VALLAURIS, France) mardi 3 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : http://public.me.com/koenigyvan
    Please : Search for questions similar to your own before submitting them to the community
    For iWork's applications dedicated to iOS, go to :
    https://discussions.apple.com/community/app_store/iwork_for_ios

  • Check a number range with date range.

    i have table test which is having column
    Start Range
    End Range
    Start Date
    End date
    how can i check start range and end range does not exists b/w existing record also with date range of this record.
    end date can be blank also.

    990690 wrote:
    i have table test which is having column
    Start Range
    End Range
    Start Date
    End date
    how can i check start range and end range does not exists b/w existing record also with date range of this record.
    end date can be blank also.Your question makes absolutely no sense whatsoever. We could make guesses, but then we may be wrong in our guesses.
    Please provide sufficient details for people to be able to help you. Read the FAQ: {message:id=9360002}

  • Stored Procedures with Date data types and Oracle

    This should be easy.... But i keep getting the error:
    [Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1,
    column 7: PLS-00306: wrong number or types of arguments in call to
    'RETRIEVE_TS' ORA-06550: line 1, column 7: PL/SQL: Statement
    ignored
    And I got it worked out to where i know it is a problem with
    the way i am using the date data types in a stored procedure....
    In the past i usually avoided calling procedures in Oracle
    with date as the in type.... It is always easiest to let oracle
    convert the string to a date.... Unfortunately now i am stuck with
    having a date type in the procedure call.... So the question is:
    WHAT IS THE PROPER WAY TO SUBMIT DATE/TIME STAMP IN A STORED
    PROCEDURE?
    The Oracle Procedure looks like this:
    PROCEDURE retrieve_ts (
    p_at_tsv_rc IN OUT sys_refcursor,
    p_units IN OUT VARCHAR2,
    p_officeid IN VARCHAR2,
    p_timeseries_desc IN VARCHAR2,
    p_start_time IN DATE,
    p_end_time IN DATE,
    p_timezone IN VARCHAR2 DEFAULT 'GMT',
    p_trim IN NUMBER DEFAULT false_num,
    p_inclusive IN NUMBER DEFAULT NULL,
    p_versiondate IN DATE DEFAULT NULL,
    p_max_version IN NUMBER DEFAULT true_num
    AND the stored procedure call looks like this:
    <cfset ed = Now()>
    <cfset sd = #DateAdd("d",-lbt,Now())#>
    <cfstoredproc datasource="CWMS"
    procedure="cwms.cwms_ts.retrieve_ts"
    returncode="no">
    <cfprocparam type="inout" variable="unit" value="#unit#"
    dbvarname="@p_units"
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="in" value="MVS"
    dbvarname="@p_officeid"
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="in" value=#id.cwms_ts_id#
    dbvarname="@p_timeseries_desc"
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="in" value="#sd#"
    dbvarname="@p_start_time"
    cfsqltype="cf_sql_date">
    <cfprocparam type="in" value="#ed#"
    dbvarname="@p_end_time"
    cfsqltype="cf_sql_date">
    <cfprocparam type="in" value="#tz#"
    dbvarname="@p_time_zone"
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="in" value="0"
    dbvarname="@p_trim"
    cfsqltype="cf_sql_numeric">
    <cfprocparam type="in" value=""
    null = "yes"
    dbvarname="@p_inclusive"
    cfsqltype="cf_sql_numeric">
    <cfprocparam type="in" value=""
    null="yes"
    dbvarname="@p_versiondate"
    cfsqltype="cf_sql_date">
    <cfprocparam type="in" value="1"
    dbvarname="@p_max_version"
    cfsqltype="cf_sql_numeric">
    <cfprocresult name="ts_dat">
    </cfstoredproc>
    Text

    Yeah.... One is a type INOUT ref cursor.... which is denoted
    by the cfprocresult....
    By the way:
    Phil - the code example with a little tweaking worked fine on
    my machine....
    <<cfstoredproc procedure="test_pkg.test"
    datasource="myDSN" returncode="no">
    <cfprocparam type="IN" cfsqltype="cf_sql_timestamp"
    value="15-JUN-2005">
    <cfprocparam type="OUT" cfsqltype="cf_sql_varchar"
    variable="v_out">
    <cfprocresult name="rs1">
    </cfstoredproc>
    PROCEDURE test(
    v3_out OUT ref_cur_type,
    v1_in IN date default null,
    v2_out OUT varchar2
    IS
    BEGIN
    v2_out := TO_CHAR(v1_in, 'mm/dd/yyyy');
    OPEN v3_out
    FOR
    SELECT *
    FROM user
    WHERE activation_date >= v1_in;
    END test;
    Why do i still get this error......
    Here is what it looks like now:
    PROCEDURE retrieve_ts (
    p_at_tsv_rc IN OUT sys_refcursor,
    p_units IN OUT VARCHAR2,
    p_officeid IN VARCHAR2,
    p_timeseries_desc IN VARCHAR2,
    p_start_time IN DATE,
    p_end_time IN DATE,
    p_timezone IN VARCHAR2 DEFAULT 'GMT',
    p_trim IN NUMBER DEFAULT false_num,
    p_inclusive IN NUMBER DEFAULT NULL,
    p_versiondate IN DATE DEFAULT NULL,
    p_max_version IN NUMBER DEFAULT true_num
    <cfstoredproc datasource="CWMS"
    procedure="cwms.cwms_ts.retrieve_ts"
    returncode="no">
    <cfprocparam type="INOUT" variable="p_units"
    value="#unit#" <!---p_units--->
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="IN" value="MVS"
    <!---p_officeid--->
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="IN" value=#id.cwms_ts_id#
    <!---p_timeseries_desc--->
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="IN" value="#sd#"
    <!---p_start_time--->
    cfsqltype="cf_sql_timestamp">
    <cfprocparam type="IN" value="#ed#"
    <!---p_end_time--->
    cfsqltype="cf_sql_timestamp">
    <cfprocparam type="IN" value="#tz#"
    <!---p_timezone--->
    cfsqltype="cf_sql_varchar">
    <cfprocparam type="IN" value="0" <!---p_trim--->
    cfsqltype="cf_sql_integer">
    <cfprocparam type="IN" value=""
    <!---p_inclusive--->
    null = "yes"
    cfsqltype="cf_sql_numeric">
    <cfprocparam type="IN" value=""
    <!---p_versiondate--->
    null="yes"
    cfsqltype="cf_sql_timestamp">
    <cfprocparam type="IN" value="1"
    <!---p_max_version--->
    cfsqltype="cf_sql_integer">
    <cfprocresult name="ts_dat">
    <!---sys_refcursor--->
    </cfstoredproc>
    If I truly am short a parameter, How do you specify the INOUT
    sys_refcursor?

  • SSRS is weird with date format

    hello everyone,
    I've got the weirdest problem.
    At first it was the calendar in internet exporer showing the dutch format (which i want). After choosing the date i try to view the report. It wil tell me the date isnt in the right format.  So for example. 22-02-2015 is wrong and should be 02-22-2015.
    For the normal user this is annoying enough and i dont understand why the datepicker acts different than the report wants.
    But now even stanger. I wanted to put a default date in my variable so i can test a bit easier. So i fill in 31-12-2015 and its accepted. But when i run the report, it tells me that the format is wrong. Soooooo. I changed the default value to 12-31-2015
    (the english format)..... BUT!!! now the variable default value isnt accepted because its not in the right format.
    Can someone please tell me how i can avoid format changes between browsers/platforms/computers or what so ever.
    there is 1 format i want and nothing else. dd-MM-yyyy thats the way and nothing else.

    Hi Fibre1980,
    As per my understanding, when you preview the report, you hope that the date is displayed in the format dd-MM-yyyy in calendar, right?
    In Reporting Services, the format of date in calendar control depends on your client machines language and regional settings. If you want to display date in the format dd-MM-yyyy, you can get parameter values from a query, so that values get populated in a
    dropdown list and displayed in your required format.
    Here is a relevant thread you can reference:
    https://social.technet.microsoft.com/Forums/en-US/6e719c7b-cfd5-4f0d-a530-f9710704446c/trouble-searching-with-date-format-usuk-formatting?forum=sqlreportingservices
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    If you have any feedback on our support, please click
    here.
    Wendy Fu
    TechNet Community Support

  • Problem with date fields in where clause after changing driver

    Hi,
    We have changed the oracle driver we use to version 10
    and now we have some trouble with date-fields.
    When we run this SQL query from our Java program:
    select *
    from LA_TRANS
    where LA_TRANS.FROM_DATE>='20040101' AND LA_TRANS.FROM_DATE<='20041231'
    We get this error code:
    ORA-01861: literal does not match format string
    The query worked fine whit the previous driver.
    Is there some way I can run a SQL query with date fields
    as strings in the where clause?
    Thanks!

    Keeping the argument of standard SQL or not aside, comparing DATE columns to a constant string (which looks like a date in one of the thousands of the formats available, but not in others) is NOT one of the best programming practices and leads to heartburn and runtime errors (as you have seen yourself).
    I would rather compare a DATE to a DATE.
    Also, constants like that would be another issue to fix in your code:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:6899751034602146050::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:528893984337,

  • SQL Loader with date formatting

    Hi,
    I'm trying to get sql loader to insert a date into a column. After much browsing, reading trial and error I still get an array of errors.
    I'm using oracle XE
    my control file looks like this
    LOAD DATA
    INFILE 'posmeters/meters.csv'
    INTO TABLE position_meters
    FIELDS terminated by ","
    ID CONSTANT '0',
    POSITION_ID,
    DATETIME DATE "DD/MM/YYYY HH24:MI:SS",
    CASH_IN,
    CASH_OUT,
    NOTES_IN,
    CHANGE_OUT,
    WINNINGS,
    VTP,
    REFILL,
    TOKEN_IN,
    TOKEN_OUT,
    ELEC_PAY,
    ELEC_CREDIT,
    REMOTE_PAY,
    REMOTE_CREDIT,
    INSERT_TS EXPRESSION "TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')",
    FIFTY_PND,
    TWENTY_PND,
    TEN_PND,
    FIVE_PND,
    TWO_PND,
    ONE_PND,
    FIFTY_P,
    TWENTY_P,
    TEN_P,
    FIVE_P
    It is the DATETIME field which gives me grief. I have a test data file that looks like this
    0,1010,29/09/2011 10:23:24,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
    and my table is defined as follows
    ID NUMBER NOT NULL,
    POSITION_ID NUMBER,
    DATETIME TIMESTAMP(6) DEFAULT localTIMESTAMP NOT NULL,
    CASH_IN NUMBER,
    CASH_OUT NUMBER,
    NOTES_IN NUMBER,
    CHANGE_OUT NUMBER,
    WINNINGS NUMBER,
    VTP NUMBER,
    REFILL NUMBER,
    TOKEN_IN NUMBER DEFAULT (0) NOT NULL,
    TOKEN_OUT NUMBER DEFAULT (0) NOT NULL,
    ELEC_PAY NUMBER DEFAULT (0) NOT NULL,
    ELEC_CREDIT NUMBER DEFAULT (0) NOT NULL,
    REMOTE_PAY NUMBER DEFAULT (0) NOT NULL,
    REMOTE_CREDIT NUMBER DEFAULT (0) NOT NULL,
    INSERT_TS TIMESTAMP(6) DEFAULT (localtimestamp) NOT NULL,
    FIFTY_PND NUMBER DEFAULT 0,
    TWENTY_PND NUMBER DEFAULT 0,
    TEN_PND NUMBER DEFAULT 0,
    FIVE_PND NUMBER DEFAULT 0,
    TWO_PND NUMBER DEFAULT 0,
    ONE_PND NUMBER DEFAULT 0,
    FIFTY_P NUMBER DEFAULT 0,
    TWENTY_P NUMBER DEFAULT 0,
    TEN_P NUMBER DEFAULT 0,
    FIVE_P NUMBER DEFAULT 0
    I have tried defining the control file with
    DATETIME DATE "DD/MM/YYYY HH24:MI:SS",
    DATETIME EXPRESSION "TO_DATE(:DATETIME, 'DD/MM/YYYY HH24:MI:SS')",
    DATETIME EXPRESSION "TO_TIMESTAMP(:DATETIME, 'DD/MM/YYYY HH24:MI:SS')",
    I get errors such as
    Record 1: Rejected - Error on table "SITE_MAIN"."POSITION_METERS", column DATETIME.
    ORA-01861: literal does not match format string
    SQL*Loader-291: Invalid bind variable DATETIME in SQL string for column DATETIME.
    any help would greatfully appreciated.

    It seems that the problem was caused by the constant at the beginning of the record and had nothing to do with date formats.
    My control file now looks like this
    LOAD DATA
    INFILE 'posmeters/meters.csv'
    APPEND INTO TABLE position_meters
    FIELDS terminated by ","
    POSITION_ID          ,
    DATETIME      date "DD/MM/YYYY HH24:MI:SS",
    CASH_IN          ,
    CASH_OUT          ,
    NOTES_IN          ,
    CHANGE_OUT          ,
    WINNINGS          ,
    VTP               ,
    REFILL          ,
    TOKEN_IN          ,
    TOKEN_OUT          ,
    ELEC_PAY          ,
    ELEC_CREDIT          ,
    REMOTE_PAY          ,
    REMOTE_CREDIT     ,
    INSERT_TS      "TO_TIMESTAMP(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')",
    FIFTY_PND          ,
    TWENTY_PND          ,
    TEN_PND          ,
    FIVE_PND          ,
    TWO_PND          ,
    ONE_PND          ,
    FIFTY_P          ,
    TWENTY_P          ,
    TEN_P          ,
    FIVE_P          
    all is good :o)

  • Formula for report to run with data of only current day

    I need a report that whenever refreshed it run with data for only the current day. It is for knowing how many checks were performed from the start of the current day to the time the report runs. Iu2019ve tried to use the select expert but I guess I need to use a formula in it.
    Thanks,
    Andreia

    Andreia,
    I think you've posted this into the wrong forum!
    -Anil

  • SQL Developer: Right-click format doesn't work right with DATE datatype

    Hi All!
    Currently I'm using version SQL Developer Version 3.1.05.
    Got a question regarding the 'auto-format' of syntax whenever writing in the code editor.
    If you take this snippet of code and drop it into a worksheet, then highlight it, right click the mouse, then select "format" it's like it fails to add the proper spacing when it runs into the DATE datatype. I looked all through the : preferences > database > sql formatter > oracle formatting > edit and couldn't find anything regarding the formatting with date types.
    Am I looking in the wrong area?? Is this a known bug? Having trouble searching for this exact issue too. I LOVE the format feature, but I hate having to go to each date type and manually spacing it out to make everything look 'clean'. I'm picky I guess :P I can live with it but figured I'd ask.
    type TEMP_REC
    IS
    record
    ORG_CODE VARCHAR2(15),
    PROJECT VARCHAR2(15),
    WBS VARCHAR2(30),
    SERIAL_NO VARCHAR2(30),
    QTY_ORDERED NUMBER,
    QTY_SCRAPPED NUMBER,
    QTY_COMPLETE NUMBER,
    BOM_ID NUMBER,
    REQUEST_DATE DATE,
    CREATE_DATE DATE,
    REL_DATE DATE,
    START_DATE DATE,
    NEED_DATE DATE,
    DUE_DATE DATE,
    COMPLETE_DATE DATE,
    CREATED_BY VARCHAR2(30),
    MODIFIED_BY VARCHAR2(30),
    MODIFY_DATE DATE,
    EST_HOURS NUMBER(6,2),
    ACT_HOURS NUMBER(6,2),
    BAD_COMMENTS VARCHAR2(1000) );

    Hello,
    I put 3.1.07 as you'd suggested. Seems the problem is still occuring for me... probably a user preference though ;)
    Open a new worksheet and drop this in, highlight everything, right-click and choose "format". All the keywords (varchar2, number, etc) should align on themselves making it look nice. I have mine set up to line-break after a comma. (I can't get it to format properly as I type it here onto the forums, so added a bunch of spaces to try to mimic it in this view)
    type TEMP_REC
    IS
    record
    LEAD_TIME NUMBER(5,0),
    SCRAP_PERCENT NUMBER,
    CREATED_BY VARCHAR2(30),
    MODIFIED_BY VARCHAR2(30),
    OPER_SEQ VARCHAR2(6),
    REF_NO VARCHAR2(2000),
    COMMENTS VARCHAR2(2000),
    BOM_FLAGS VARCHAR2(100),
    BOM_ATTR1 VARCHAR2(30),
    BOM_ATTR2 VARCHAR2(30),
    BOM_ATTR3 VARCHAR2(30),
    BOM_AMT1 NUMBER,
    BOM_AMT2 NUMBER,
    BAD_COMMENTS VARCHAR2(1000) );
    Now, let's add another field in there, but this time a date/timestamp datatype. If you format it like this you will see that the keywords sort of 'reset' their position after it encounters a date/timestamp datatype. The date type doesn't align properly with the others.
    type TEMP_REC
    IS
    record
    LEAD_TIME NUMBER(5,0),
    SCRAP_PERCENT NUMBER,
    CREATED_BY VARCHAR2(30),
    MODIFIED_BY VARCHAR2(30),
    OPER_SEQ VARCHAR2(6),
    REF_NO VARCHAR2(2000),
    test DATE,
    COMMENTS VARCHAR2(2000),
    BOM_FLAGS VARCHAR2(100),
    BOM_ATTR1 VARCHAR2(30),
    BOM_ATTR2 VARCHAR2(30),
    BOM_ATTR3 VARCHAR2(30),
    BOM_AMT1 NUMBER,
    BOM_AMT2 NUMBER,
    BAD_COMMENTS VARCHAR2(1000) );
    Might post a picture next time if that still isn't clear, though I konw folks are leary against clicking links to see screenshots. Might you know what I'm doing wrong here?

  • Strange Behavior with Data Merge (CS4) - Advice?

    This is the most bizarre behavior and I may have to chalk it up to a full moon or something since I can't reproduce it and I cannot find any hints as why this happened. This is my last attempt at figuring a solution...maybe someone has experienced this??? Anyway, here's what happened...
    I do a data merge for addressing envelopes. Been using the InDesign data merge feature for a couple of years now, no problems.
    My address list is approximately 1200. It's in a .csv file with the following fields: fname, lname, company, address1, address2, city, state, zip
    For my last mailing, approximately 300 addresses were merged wrong. Here's the crazy thing it did: instead of using the address1 field for the current record, it used the address1 field from the NEXT record, and ONLY the address1 field.
    Here's more bizarre-ness. The NEXT record was merged correctly.
    For example:
    Record 1 (address1 should be 555 Cherry Lane, Apt 5)
    John Smith
    Smith Company
    123 Main Street, Apt 5
    Small Town, CA 12345
    Record 2 (John Smith's address used THIS address1, but NOT address2 or any other field! Jane Doe's address is correct)
    Jane Doe
    Doe Company
    123 Main Street, Suite 300
    Big Town, TX 56789
    I've tested. I've looked for commonality in the records, where it's placed, if there was something unusual about it's format. I come up empty. The incorrect data seem randomly interspersed.
    One thing that I have to do is break up the actual merge. Either my computer memory or InDesign can't handle 1200 merge records. So, I merge approximately 200 records at a time (I make 6 print files). I don't know if this has anything to do with it (like I said, the incorrect data is interspersed all through out), but, thought I'd mention it.
    Any advice is appreciated. I'm hesitant to use it again until I can understand why this happened.
    thanks much,
    Kia

    CS was soemtimes flakey in this way with Data Merge.
    Are you updated to the latest patch? Most issues were resolved at some point.
    That said, I recall another user with this problem, and it never resolved with his particular file. I examined the data file and couldn't find any issues, but it behaved identically on my system tot he way it did on his so I can only conclude there was still some bug, or something about the data file that we were unable to detect. I seem to recall that the same data file merged correctly in CS3, but I don't recall if I saved it long enough to test in CS5. I've not had any issues with my own files in any version.
    Open the file in a plain text editor and look for any odd characters (I'd start the search where the merge first fails). Also do a Save As from the text editor to make sure there is no possibility of formatting from your spread sheet having found its way in.

  • Need to rescue Garage Band Files with Data Rescue II - what kind of files?

    Hi all -
    After a particularly gruesome computer crash, I am trying to reconstruct my lost files using Data Rescue II..... This program goes into the damaged hard drive and downloads all intact files it can find, but it is NOT able to label everything correctly. All it can do is divide things into folders - Audio files, document files, images, mail, misc., and movies. And within these folders are other folders - for instance, in the "Audio" rescued folder, there are hundreds of AIFF files, AIFF1 files, AIFF2, MP3, WAV, m4a, and m4p files.
    My question is: can someone please tell me what the heck a Garage Band project file is? That would save me a lot of time in digging through all this material trying to find one....
    (Don't get me wrong... I'm grateful to have stuff to dig through! I just hope my Garage Band files are intact and recoverable.)
    Has anyone had success saving Garage Band files with Data Rescue II?
    Thanks in advance.

    Aaaagh!
    I spoke too soon. Yes,I did indeed find the file that contained all the files I needed to retrieve (using Disk Rescue II). When my 6-hour download of the 78 GB folder finished, I check the files again, and they weren't located in the orphaned section, but in the Hard Drive section under the normal directory, in a folder called .Trashes - within that there was another folder called "501", which contained all the Garageband files I needed to retrieve. However, when I tried to open the downloaded "rescued" files, they were inside a folder called "Macintosh HD", which could not be opened, and I got a message that said "Could not be opened because you do not have sufficient access privileges." Not only that, but even after 6 hours of (apparently) downloading the 78 GB folder, my hard drive, which had close to 83 GB of free space, said STILL had almost that same amount.
    So did it download anything or not? What was it doing all those 6 hours? I have a file that I can't open, but apparently it's going to be empty anyway.
    Here's the full story, for anyone with the patience to listen and offer advice. It looks like now I'm looking for a way to 1) get the permissions to open the .trashes file so that I can download everything, or 2) figure out a way to get Disk Rescue II to open the files and download them regardless of the permissions.
    Full Story -
    I am pretty sure that my computer crash was caused by working with the newest version of Garageband 08. Ever since buying it and loading it, my computer has been acting funny whenever I use the Garage Band program - I could only record about one in three attempts since the computer kept freezing as soon as I finished recording a line. I would have to use force restart to get going again.
    The day the computer crashed, I was working on a Garage Band project, which kept crashing, and I was also using Finale, Microsoft Word, and iTunes -- all of which are my normal procedure and I'd never had any problems with anything before loading the new Garage Band 08. (See my posts on other discussion topics for more details). After the last freeze, the computer crashed totally and could not be restarted - it would get to the gray screen with the spinning gear and just sit there while the fans ramped up to overload.
    I used Disk Warrior to rescue whatever files I could onto an external hard drive, and I started to download all the Garage Band files. However, the "estimated time to completion" said over 6 hours , so I stopped the download after a minute or so and went on to rescue all the other files that were smaller in size and easier to download - I figured I'd set Disk Warrior to download the whole 78 GB set of Garage Band files overnight while I slept. But....when I went back to begin the download again, I noticed that the directory of Garage Band files went only to the letter "C" instead of all the way to "Z" like my original files had done during that earlier attempt to download. I am assuming that somehow, the directory for the files I download before aborting the attempt (A-C) got exchanged with the directories of the original version (A-Z), but the original directory was no where to be found.
    I decided to try an archive install in the hopes that I could just restart my computer and get the files out by hand. The archive install went fine, and the computer started up fine and got to the log-in screen, which had changed. I now had two blanks - one for user name and one for password, instead of the choices of names. I tried all my user names and passwords, and asked my wife for her names and passcodes, but nothing worked. The computer had apparently re-set all its permissions and User accounts. I tried using Disk Utility to reset the password in its opening screens, but instead of getting several User options, the only one it allowed me to attempt was "System Administrator (root)", and even that wouldn't let me in to change any passwords.
    That's when I downloaded Data Rescue II, which does seem to do a good job of locating lost files. However, since I didn't have permissions to open the computer the last time, I am still apparently facing the same thing when I try to access files copies OFF the computer.
    So I'm not out of the woods yet. I can see the files on the Data Rescue screen, but I don't know whether they have permissions tied to them or not, and if they do, whether the system would let me since I don't know what the passwords and user names have defaulted back to.
    Any advice? Please?

  • Table with DropDownBox with data from child node

    Hi,
    I have following context:
    Node Parent (0..n)
    -- Node Child (0..n)
    Child Attribute 1
    Child Attribute 2
    -- Parent Attribute 1
    -- Parent Attribute 2
    The parent node has a child node with cardinality 0..n. Now I created a table from the Parent node with several columns. In one column is a
    DropDownBox that should display the data of the Child node, depending on the Parent node element.
    Parent             |  Parent  DropDownBox           |
    Parent 1                       | Parent 1 Child Attribute 1     |
    Parent 1 Child Attribute 2     
    Parent 2            | Parent 2 Child Attribute 1     |
    Parent 2 Child Attribute 2     
    How can I fill the child node with data depending on the parent node element? How is the mapping between both?
    IParentElement parentElement;
    IChildElement childElement;
    while (rs.next()) {
       parentElement = wdContext.createParentElement();
       parentElement.setAttribute1(rs.getLong("ID"));
       parentElement.setAttribute2(rs.getString("SYSTEM"));
       wdContext.nodeParent().addElement(parentElement);
          while (rs2.next()){               
             childElement = wdContext.createChildElement();
             childElement.setAttribute1(rs2.getLong("ID"));
             childElement.setAttribute2(rs2.getString("NAME"));
             wdContext.nodeChild().addElement(childElement);
    If the child node is non-singleton I have the following option
    parentElement.nodeChild.addElement(childElement);
    But this doesn't work for singleton nodes. How can I do something similar for singleton nodes?
    Thanks for your help,
    Andi

    Not quite correct.
    You can add more than one <b>element</b> to a singleton node (if cardinality is *:N).
    But a singleton child node exists only once per parent <b>node </b>and not once per parent <b>element</b>.
    That's an important difference.
    Armin

  • Infocube and ODS populated with DATA (need to add one more field?)

    Hi,
      If infocube and ODS have been populated with data for past 3 months. Then we need to add one more field to this cube. What is the impact? Please advise.
    The following is my understanding. Please correct me if I am wrong.
    1) Need to delete content of ODS and infocube.
    2) insert the new field at ODS and infocube.
    3) reload the data into ODS and infocube.
    Is there a way that the current data need not be deleted.
    Just add in this new field and only subsequent month, infocube will have this new field? Please advise what is the best approach without affecting existing data.

    Hi,
    Siggi is right. You dont need to delete the previously loaded data to CUBE or ODS. The only catch is that, your new field will be empty as far as history is concerned. But so long as you did map it to the datasource and the datasource is able to fill it up, then your new field will now have value for incoming DELTA Updates.
    Addition of a field is not that complicated compared to deletion of a field from CUBE or ODS.
    --Jkyle

Maybe you are looking for

  • How can I use an external hard drive to both back up and free up storage on my macbook?

    I've used a hard drive to back up my 2012 Macbook Pro via Time Machine, but I'm not sure how to use it as external storage to move things like video and music off of my Mac to free up memory and then how to move the same things from the hard drive on

  • Photoshop Lightroom 4.3 installer problem extracting files

    I am using Windows 7. I have downloaded Lightroom 4.3 trial (using Safari as IE refused). I click to run the download. It chooses folder "C:\Users\sarah.horsman\Desktop\Adobe\Photoshop Lightroom 4.3" by default. The bar gives 100% complete then pops

  • PLEASE HELP! DESPERATE!

    Working on an older G5, FCP 5.0.1, media on an external Iomega 750gig with plenty of available space. 1.2 gigs freespace on the hard drive of the G5, running Leopard. All was well until this evening when I got several 'out of memory free up memory' e

  • Hide ringtones from the Music Player [S60]

    Tired of having your ringtones listed and played together with your music? Here's how you can hide the tones from the Music Player. This is applicable for Symbian phones only (N82, N95, etc.). WARNING: The advise below involves changing folder attrib

  • Time, more taken in index creation

    when i create an normal index on one column or an composite index on 3-4 columns on a table having say 9-10 million records, the time is too much, i did it in our test database & it too upto an hour to create the index. Please help in explaining, why