Error ORA-01841: (full) year must be between -4713 and +9999, and not be 0

Hi Experts,
I seem to be getting the error "Error ORA-01841: (full) year must be between -4713 and +9999, and not be 0" when my dates are in the year 2000. Here's my SQL:
DROP TABLE PER_ALL_ASSIGNMENTS_M_XTERN;
create table PER_ALL_ASSIGNMENTS_M_XTERN(
PERSON_NUMBER                    VARCHAR2(30 CHAR),
ASSIGNMENT_NUMBER VARCHAR2(30 CHAR),
EFFECTIVE_START_DATE                DATE,
EFFECTIVE_END_DATE           DATE,
EFFECTIVE_SEQUENCE           NUMBER(4),
ASS_ATTRIBUTE_CATEGORY           VARCHAR2(30 CHAR),
ASS_ATTRIBUTE1 VARCHAR2(150 CHAR),
ASS_ATTRIBUTE_NUMBER20 NUMBER,
ASS_ATTRIBUTE_DATE1 DATE,
ASS_ATTRIBUTE_DATE2 DATE,
ASS_ATTRIBUTE_DATE3 DATE,
ASS_ATTRIBUTE_DATE4 DATE,
ASS_ATTRIBUTE_DATE5 DATE,
ASS_ATTRIBUTE_DATE6 DATE,
ASS_ATTRIBUTE_DATE7 DATE,
ASS_ATTRIBUTE_DATE8 DATE,
ASS_ATTRIBUTE_DATE9 DATE,
ASS_ATTRIBUTE_DATE10 DATE,
ASS_ATTRIBUTE_DATE11 DATE,
ASS_ATTRIBUTE_DATE12 DATE,
ASS_ATTRIBUTE_DATE13 DATE,
ASS_ATTRIBUTE_DATE14 DATE,
ASS_ATTRIBUTE_DATE15 DATE,
ASG_INFORMATION_CATEGORY           VARCHAR2(30 CHAR),
ASG_INFORMATION1 VARCHAR2(150 CHAR),
ASG_INFORMATION_NUMBER20 NUMBER,
ASG_INFORMATION_DATE1 DATE,
ASG_INFORMATION_DATE2 DATE,
ASG_INFORMATION_DATE3 DATE,
ASG_INFORMATION_DATE4 DATE,
ASG_INFORMATION_DATE5 DATE,
ASG_INFORMATION_DATE6 DATE,
ASG_INFORMATION_DATE7 DATE,
ASG_INFORMATION_DATE8 DATE,
ASG_INFORMATION_DATE9 DATE,
ASG_INFORMATION_DATE10 DATE,
ASG_INFORMATION_DATE11 DATE,
ASG_INFORMATION_DATE12 DATE,
ASG_INFORMATION_DATE13 DATE,
ASG_INFORMATION_DATE14 DATE,
ASG_INFORMATION_DATE15 DATE
organization external
( default directory APPLCP_FILE_DIR
access parameters
( records delimited by newline skip 1
     badfile APPLCP_FILE_DIR:'PER_ALL_ASSIGNMENTS_M_XTERN.bad'
logfile APPLCP_FILE_DIR:'PER_ALL_ASSIGNMENTS_M_XTERN.log'
fields terminated by ',' OPTIONALLY ENCLOSED BY '"'
(PERSON_NUMBER,     
ASSIGNMENT_NUMBER,
EFFECTIVE_START_DATE CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
EFFECTIVE_END_DATE CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
EFFECTIVE_SEQUENCE,
ASS_ATTRIBUTE_CATEGORY,
ASS_ATTRIBUTE1,
ASS_ATTRIBUTE_NUMBER20,
ASS_ATTRIBUTE_DATE1 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE2 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE3 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE4 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE5 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE6 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE7 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE8 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE9 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE10 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE11 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE12 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE13 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE14 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASS_ATTRIBUTE_DATE15 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_CATEGORY,
ASG_INFORMATION1,
ASG_INFORMATION_NUMBER20,
ASG_INFORMATION_DATE1 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE2 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE3 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE4 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE5 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE6 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE7 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE8 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE9 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE10 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE11 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE12 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE13 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE14 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY",
ASG_INFORMATION_DATE15 CHAR(20) DATE_FORMAT DATE MASK "DD-MON-YYYY"
location ('PER_ALL_ASSIGNMENTS_M.csv')
REJECT LIMIT UNLIMITED;
...and getting errors when data looks like the following:
E040101,EE040101,*1-Aug-2000*,31-Dec-4712,1,,NDVC,YES,DE,SFC,N,STIP Plan - Pressure,,,,,,,E040101,,,,2080,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,31113,31113,31113,31113,31113,31113,,,1-Jan-2012,31-Dec-2012,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
...error message:
error processing column EFFECTIVE_START_DATE in row 19 for datafile /u05/dbadir/jmf/incident_logs/PER_ALL_ASSIGNMENTS_M.csv
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
Thanks,
Thai

Here is a snippet of the bad file data:
E040110,EE040110,01-Aug-00,31-Dec-12,1,,NDVC,YES,DE,SFC,N,STIP Plan - Pressure,,,,,,,E040110,,,,2080,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,27667.2,27667.2,27667.2,27667.2,27667.2,27667.2,,,01-Jan-12,31-Dec-12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
E040100,EE040100,01-May-00,31-Dec-12,1,,NDVC,YES,DE,SFC,N,STIP Plan - Pressure,,,,,,,E040100,,,,2080,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,31113,31113,31113,31113,31113,31113,,,01-Jan-12,31-Dec-12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
E040101,EE040101,01-Aug-00,31-Dec-12,1,,NDVC,YES,DE,SFC,N,STIP Plan - Pressure,,,,,,,E040101,,,,2080,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,31113,31113,31113,31113,31113,31113,,,01-Jan-12,31-Dec-12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
E000916,EE000916,01-Oct-00,31-Dec-12,1,,NDVC,YES,NL,SFC-Commercial,E,SIP Plan - Control Technologies,,,,,,,E000916,21000000,555000,99000,2080,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,,,,,,,,,,,,34905.65,34905.65,34905.65,34905.65,34905.65,34905.65,,,01-Jan-12,31-Dec-12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
E000807,EE000807,03-Jan-00,31-Dec-12,1,,NDVC,YES,FR,SFC-Commercial,E,STIP Plan - Cross BU,,,,,,,E000807,,,,2080,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,,,,,,,,,,,35448.56,35448.56,35448.56,35448.56,35448.56,35448.56,,,01-Jan-12,31-Dec-12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
E000851,EE000851,25-Apr-00,31-Dec-12,1,,NDVC,YES,FR,SFC-Commercial,E,SIP Plan - Control Technologies,,,,,,,E000851,21000000,555000,99000,2080,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13,,,,,,,,,,,,43283.76,43283.76,43283.76,43283.76,43283.76,43283.76,,,01-Jan-12,31-Dec-12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
So, the successfully loaded data is being loaded where year=2003 in the CSV as year=0003. Even though the data is loaded fine the data is not correct. For some reason the external table is set to have the year truncated.

Similar Messages

  • Regarding the error ORA-01841: (full) year must be between -4713 and +9999,

    The issue is the code is not inserting the good records into the MIE table. This is becasue of the error 'OtherError GFSTM_INS_SNURK_NEW_TABLES_PA.gfstm_ins_asn_journal_pr:ORA-01841: (full) year must be between -4713 and +9999, and not be 0' This error is throwing out because of space issue in dt_asn_shipped.
    My requirement is to log error if any if not get the next record in the loop and insert it in the table if it has no error. The issue is good records are not getting inserted. The snurk_cmms_crct018_asn_journl in the cursor is a synonym which uses dblionk to connect to the remote db. The dt_asn_shipped data type is char(6) and the format is YYMMDD.
    declare
    CURSOR cur_asn_journal IS
    SELECT NVL(TRIM(cd_asn_plant),' ') cd_asn_plant,
         NVL(TRIM(no_journal),0) no_journal,
    NVL(TRIM(cd_ship_from),' ') cd_ship_from,
         TRIM(no_asn) no_asn,
    DECODE(LENGTH(dt_asn_shipped),6, to_date(to_char(to_date(trim(dt_asn_shipped),'YYMMDD'),
    'DD-MON-YY'),'DD-MON-YY'), '') dt_asn_shipped,
    TRIM(dt_processed) dt_processed,
    TRIM(in_manual) in_manual,
         TRIM(ts_last_update) ts_last_update     
    FROM snurk_cmms_crct018_asn_journl;
    BEGIN
    FOR l_rec_asn_journal IN cur_asn_journal LOOP
    BEGIN
    INSERT INTO gfstmie_st_cmms_asn_journal
    gsdb_site_code ,
    journal_num,
    gsdb_site_from_code,
    adv_shipping_notice_cnum,
    adv_sn_shipping_date,
    processed_date,
    manual_in_code,
    cmms_last_update_cdate,
    create_userid,
    create_dts,
    update_userid,
    update_dts
    ) VALUES
    l_rec_asn_journal.cd_asn_plant,
    l_rec_asn_journal.no_journal,
    l_rec_asn_journal.cd_ship_from,
    l_rec_asn_journal.no_asn,
    l_rec_asn_journal.dt_asn_shipped,
    l_rec_asn_journal.dt_processed,
    l_rec_asn_journal.in_manual,
    l_rec_asn_journal.ts_last_update,
    g_con_user_id,
         l_dts_current_gmt,
    g_con_user_id,
    l_dts_current_gmt
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('l_num_exception_pt_7');
    --To assign value to error attributes
    l_str_email_body := GFSTU_MSG_CONTEXT_STACKER_PA.gfstu_add_msg_context_fn(
    SQLERRM || l_str_process_track,
    g_con_package_name || l_con_proc_name,
    g_con_string_null);
    l_rec_apm_error_attributes.job_run_sakey := l_num_job_run_id;
    l_rec_apm_error_attributes.proj_acronym_code := GFSTM_PARM_SPECIFICATION_PA.g_con_proj_acronym_code_ta;           
    l_rec_apm_error_attributes.module_code := l_con_module_code;
    l_rec_apm_error_attributes.notes_text := l_str_email_body;
    l_rec_apm_error_attributes.msg_id := GFSTM_PARM_SPECIFICATION_PA.g_con_msg_id_invalid_date;
    --Calling procedure to log and notify subscribers of transaction
    --related errors and informational messages
    GFSTM_COMMON_UTL_PA.gfstm_log_message_pr(
    SUBSTR(l_str_email_body,1,2000),
    g_con_string_null,
    g_con_string_null,
    SUBSTR(l_str_email_body,1,2000),
    l_rec_apm_error_attributes,
    g_con_string_null,
    l_num_wait_time,
    l_num_wait_interval_time,
    l_str_msg_action_code,
    l_num_oracle_error_code,
    l_str_oracle_msg,
    l_num_return_code,
    l_num_status);
    END;
    END LOOP;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('l_num_exception_pt_12');
    DBMS_OUTPUT.PUT_LINE('l_num_exception_pt_2 '||l_str_procg_mode_code);
    --Rollback uncommitted transactions
    ROLLBACK;
    --Assigning failure status
    o_num_status := g_con_status_failure;
    --Assigning procedure end time in GMT
    l_dts_end_time := GFSTU_DATETIME_UTILITIES_PA.gfstu_to_gmt_fn;
    --To assign value to error attributes
    l_str_email_body := GFSTU_MSG_CONTEXT_STACKER_PA.gfstu_add_msg_context_fn(
    SQLERRM || l_str_process_track,
    g_con_package_name || l_con_proc_name,
    g_con_string_null);
    l_rec_apm_error_attributes.job_run_sakey := l_num_job_run_id;
    l_rec_apm_error_attributes.proj_acronym_code := GFSTM_PARM_SPECIFICATION_PA.g_con_proj_acronym_code_ta;           
    l_rec_apm_error_attributes.module_code := l_con_module_code;
    l_rec_apm_error_attributes.notes_text := l_str_email_body;
    l_rec_apm_error_attributes.msg_id := GFSTM_PARM_SPECIFICATION_PA.g_con_msg_id_oracle;
    --Calling procedure to log and notify subscribers of transaction
    --related errors and informational messages
    GFSTM_COMMON_UTL_PA.gfstm_log_message_pr(
    SUBSTR(l_str_email_body,1,2000),
    g_con_string_null,
    g_con_string_null,
    SUBSTR(l_str_email_body,1,2000),
    l_rec_apm_error_attributes,
    g_con_string_null,
    l_num_wait_time,
    l_num_wait_interval_time,
    l_str_msg_action_code,
    l_num_oracle_error_code,
    l_str_oracle_msg,
    l_num_return_code,
    l_num_status);
    --Calling procedure to update the job status
    GFSTM_COMMON_UTL_PA.gfstm_update_job_status_pr(
    l_num_job_run_id,
    GFSTM_PARM_SPECIFICATION_PA.g_con_process_abort,
    l_dts_end_time,
    g_con_perf_metric_code,
    g_con_zero,
    g_con_n,
    l_num_oracle_error_code,
    l_str_oracle_msg,
    l_num_return_code,
    l_num_status);
    END ;
    Thanks,
    Vinodh

    Hi,
    Could you not have reduced your question to what is relevant?
    You seem to be saying that this is your problem:
    SELECT DECODE ( LENGTH (dt_asn_shipped),
              6,
              TO_DATE ( TO_CHAR ( TO_DATE ( TRIM (dt_asn_shipped), 'YYMMDD'), 'DD-MON-YY'), 'DD-MON-YY'),
             dt_asn_shipped
    FROM   snurk_cmms_crct018_asn_journl;As far as I can see, problem might be that you decode on UNTRIMMED length.
    Also, you could get rid of some the to_date(to_char(to_date), which is nothing more than simply to_date()
    Try something like
    SELECT CASE LENGTH (TRIM (dt_asn_shipped))
             WHEN 6 THEN TO_DATE ( TRIM (dt_asn_shipped), 'YYMMDD')
           END
             dt_asn_shipped
    FROM   snurk_cmms_crct018_asn_journl;Regards
    Peter

  • ORA-01841 - (full) year must be between -4713 and +9999, and not be 0

    Hi Comunnity,
    Let me explain the scenario:
    We want to replicate a number of Discoverer reports, adding more columns to the reports. Due to the internal structure of the views and materialized tables, we can not make the joins inside the Discoverer Administration Edition, so we have decided to replicate the original materialized table adding the columns in order to get what we want. So the new materialized table has built as follows:
    CREATE TABLE APPS.GUZMAN_STOCK_DEPRE_EXIST_MAT_X
    EMPRESA VARCHAR2(240 BYTE),
    COD_ORGANIZACION NUMBER,
    COD_SECCION VARCHAR2(40 BYTE),
    SECCION VARCHAR2(4000 BYTE),
    FAMILIA VARCHAR2(40 BYTE),
    NOMBRE_PRODUCTO VARCHAR2(240 BYTE),
    DESCRIPCION_ARTICULO VARCHAR2(240 BYTE),
    UNIDAD_EXISTENCIA_ACT NUMBER,
    PRECIO_MEDIO NUMBER,
    FECHA_ULT_VENTA DATE,
    FECHA_ULT_COMPRA DATE,
    FECHA_ULT_MOVIMIENTO DATE,
    PRECIO_ULT_COMPRA NUMBER,
    CLASE_UNIDAD VARCHAR2(40 BYTE),
    COD_ORG_INV NUMBER,
    ORG_INV_NAME VARCHAR2(240 BYTE),
    COD_ARTICULO NUMBER,
    AÑO VARCHAR2(2 BYTE),
    MES VARCHAR2(2 BYTE),
    ULTIMO_DIA_TRANS DATE,
    SEIS_MESES_ANTES DATE,
    DOCE_MESES_ANTES DATE,
    DIECIOCHO_MESES_ANTES DATE,
    SEIS_MESES NUMBER,
    SIETE_DOCE_MESES NUMBER,
    TRECE_DIECIOCHO_MESES NUMBER,
    FCOMVACIA NUMBER,
    TIPO_ARTICULO VARCHAR2(80 BYTE),
    TRANSACTION_ID NUMBER,
    FECHA_MOVIMIENTO DATE,
    TIPO_MOVIMIENTO VARCHAR2(80 BYTE)
    TABLESPACE APPLSYSD
    PCTUSED 40
    NOMONITORING;
    The bold fields are the new ones. So we added the materialized table as a new folder in our working business area and add the following new intems:
    Valor Compra = CASE WHEN Precio Ult Compra = 0 THEN Importe Stocks ELSE Unidad Existencia Act*Precio Ult Compra END
    Importe Stocks = Unidad Existencia Act*Precio Medio
    Depreciación = CASE WHEN Valor Compra < Importe Stocks THEN Importe Stocks-Valor Compra ELSE 0 END
    DiasMes = CASE WHEN ((((((Mes = '01' OR Mes = '03') OR Mes = '05') OR Mes = '07') OR Mes = '08') OR Mes = '10') OR Mes = '12') THEN 31 WHEN (((Mes = '04' OR Mes = '06') OR Mes = '09') OR Mes = '11') THEN 30 ELSE 28 END
    fecha_MES = TO_NUMBER(CONCAT(DiasMes,Mes))
    Nueva_Fecha = TO_DATE(CONCAT(fecha_MES,Ano))
    Dias = NVL(Nueva_Fecha-Fecha Ult Venta,0)
    PorcenDepre = CASE WHEN Dias = 0 AND DiasC < 181 THEN 0 WHEN Dias = 0 AND DiasC > 180 THEN 100 WHEN Dias < 181 THEN 0 WHEN Dias < 361 THEN 25 WHEN Dias < 540 THEN 50 WHEN Dias > 541 THEN 100 ELSE 0 END
    Valor Depr = Valor Compra*PorcenDepre/100
    DiasC = NVL(Nueva_Fecha-Fecha Ult Compra,0)
    PorcenDepreC = CASE WHEN DiasC = 0 THEN 100 WHEN DiasC < 181 THEN 0 WHEN DiasC < 361 THEN 25 WHEN DiasC < 540 THEN 50 WHEN DiasC > 541 THEN 100 ELSE 0 END
    Valor DepreC = Valor Compra*PorcenDepreC/100
    T6 = CASE WHEN Unidad Existencia Act >= SEISMESES THEN SEISMESES ELSE Unidad Existencia Act END
    T12 = CASE WHEN Unidad Existencia Act-T6 > DOCEMESES THEN DOCEMESES WHEN Unidad Existencia Act-T6 < DOCEMESES THEN Unidad Existencia Act-T6 WHEN Unidad Existencia Act-T6 = DOCEMESES THEN Unidad Existencia Act-T6 END
    T18 = CASE WHEN Unidad Existencia Act-( T6+T12 ) > DIECIOCHOMESES THEN DIECIOCHOMESES WHEN Unidad Existencia Act-( T6+T12 ) < DIECIOCHOMESES THEN Unidad Existencia Act-( T6+T12 ) WHEN Unidad Existencia Act-( T6+T12 ) = DIECIOCHOMESES THEN Unidad Existencia Act-( T6+T12 ) END
    TR = Unidad Existencia Act-( T6+T12+T18 )
    DT6 = T6*Precio Medio*0/100
    DT12 = ( T12*Precio Medio )*25/100
    DT18 = T18*Precio Medio*50/100
    DTR = TR*Precio Medio*100/100
    DTOTAL = DT6+DT12+DT18+DTRVCIA+DFCOMPVCIA
    SEISMESES = CASE WHEN NVL(Seis Meses,0) < 0 THEN 0 ELSE NVL(Seis Meses,0) END
    DOCEMESES = CASE WHEN NVL(Siete Doce Meses,0) < 0 THEN 0 ELSE NVL(Siete Doce Meses,0) END
    DIECIOCHOMESES = CASE WHEN NVL(Trece Dieciocho Meses,0) < 0 THEN 0 ELSE NVL(Trece Dieciocho Meses,0) END
    FCOMPVCIA = DECODE(Fecha Ult Compra,NULL,Unidad Existencia Act,0)
    TRVCIA = TR-FCOMPVCIA
    DTRVCIA = TRVCIA*Precio Medio*100/100
    DFCOMPVCIA = FCOMPVCIA*Precio Medio*100/100
    Due to Discoverer does not allow foreign characters (ñ), we have changed the name of Field Año to Ano (as you can check in the Nueva_Fecha calculated field).
    Now, when we select the fields (Empresa, Cod Sección, Nombre Producto, Unidad Existencia Act, Precio Medio, Fecha Ult Venta, Fecha Ult Compra, Fecha Ult Movimiento, Precio Ult Compra, Org Inv Name, Ano, Mes, Valor Compra, Importe Stocks, Depreciación, Dias, PorcenDepre, Valor Depr, DiasC, PorcenDepreC, ValorDepreC) in order to build a new report, Discoverer shows us the ORA-01841 Error.
    Can be produced the error by the way in which discoverer stores the Nueva_Fecha Field?, cause as we check the field in Adminostration Edition, it appears as TO_DATE(CONCAT(fecha_MES,'Ano')) (with the field Ano in simple quotes), or just by any other circumstance?
    Thanks a lot for your help.
    Luis.
    Update:*
    It seems that the problem comes with the item created in Discoverer Administration Edition "Nueva_Fecha":
    Nueva_Fecha = TO_DATE(CONCAT(fecha_MES,Ano))
    (Keep in mind that:
    fecha_MES = TO_NUMBER(CONCAT(DiasMes,Mes))
    DiasMes = CASE WHEN ((((((Mes = '01' OR Mes = '03') OR Mes = '05') OR Mes = '07') OR Mes = '08') OR Mes = '10') OR Mes = '12') THEN 31 WHEN (((Mes = '04' OR Mes = '06') OR Mes = '09') OR Mes = '11') THEN 30 ELSE 28 END
    ), so any created field that uses Nueva_Fecha or is derivated from Nueva_Fecha causes the error (e.g. --> Dias = NVL(Nueva_Fecha-Fecha Ult Venta,0))
    Then; How can we configure the field in order that discoverer deals with it as a date field?
    Regards,
    Luis.
    Edited by: GGOracle User on 27-may-2010 15:23

    Hi,
    I think you forgot the separator in the string you want to convert to date.
    Your problem lies in the format of the date you are trying to create.
    try
    Nueva_Fecha = TO_DATE(DiasMes||'-'||Mes||'-'||Ano ,'DD-MM-YYYY')
    BTW
    you can use || instead of CONCAT so that you can concatenate more than 2 values each time
    Tamir

  • ORA-01841 full year must be between .....error when order by

    Hi all
    i have this query with me ,when order by clause is included ,when it is removed ,i see the output with  so  many record counts
    SELECT   porh.segment1,
             CASE
                WHEN popr.action_code = 'APPROVE'
                AND prall.full_name <> 'Sudheer T. Paraputhra'
                AND grdpr.short_name < 'PS-10'
                   THEN prall.full_name
             END directman_pr,-----getting names of managers who perform PR approve action
             porh.description, porl.line_num,
             CASE
                WHEN popr.action_code = 'APPROVE'
                AND prall.full_name <> 'Sudheer T. Paraputhra'
                AND grdpr.short_name < 'PS-10'
                AND poph.action_code = 'SUBMIT'
                   THEN TO_NUMBER (  TO_CHAR (  TO_DATE ('1', 'J')
                                              + (  poph.action_date
                                                 - popr.action_date
                                              'J'
                                   - 1
             END days_pr,------------------------------(calculating days from PR approval by manager to PO submit by user)
             poha.segment1 po_num, prall.full_name pr_approved_by,
             popr.action_date pr_approved_date,
             CASE
                WHEN poall_apprv.full_name <> 'Sudheer T. Paraputhra'
                AND grdpo_apprv.short_name < 'PS-10'
                AND poph_apprv.action_code = 'APPROVE'
                AND poph.action_code = 'SUBMIT'
                   THEN TO_NUMBER (  TO_CHAR (  TO_DATE ('1', 'J')
                                              + (  poph_apprv.action_date
                                                 - poph.action_date
                                              'J'
                                   - 1
             END days_po,------calculating days  from PO submit action by user to PO approve action by managers
             popr.sequence_num pr_seq, popr.action_code pr_action,
             poall.full_name po_approved_by, poph.action_date po_approved_date,
             poph.sequence_num po_seq, poph.action_code po_action,
             poph_apprv.action_date po_approved_date_appr,
             poph_apprv.action_code apprv_action_code
        FROM po_requisition_headers_all porh,
             po_requisition_lines_all porl,
             po_req_distributions_all prda,
             po_distributions_all poda,
             po_headers_all poha,
             po_action_history popr,
             po_action_history poph,
             hr.per_all_people_f poall,
             hr.per_all_people_f prall,
             hr.per_all_assignments_f asgpo,
             hr.per_all_assignments_f asgpr,
             per_grades_vl grdpo,
             per_grades_vl grdpr,
             po_headers_all poha_apprv,
             po_distributions_all poda_apprv,
             po_action_history poph_apprv,
             hr.per_all_people_f poall_apprv,
             hr.per_all_assignments_f asgpo_apprv,
             per_grades_vl grdpo_apprv
       WHERE poph.employee_id = poall.person_id
         AND popr.employee_id = prall.person_id
         AND poall.person_id = asgpo.person_id
         AND prall.person_id = asgpr.person_id
         AND asgpr.grade_id = grdpr.grade_id(+)
         AND asgpo.grade_id = grdpo.grade_id(+)
         AND prda.distribution_id = poda.req_distribution_id
         AND poha.po_header_id = poda.po_header_id
         AND prda.requisition_line_id = porl.requisition_line_id
         AND porh.requisition_header_id = porl.requisition_header_id
         AND porh.requisition_header_id = popr.object_id
         AND poph.object_type_code = 'PO'
         AND poha.po_header_id = poph.object_id
         AND SYSDATE BETWEEN poall.effective_start_date AND poall.effective_end_date
         AND SYSDATE BETWEEN prall.effective_start_date AND prall.effective_end_date
         AND SYSDATE BETWEEN asgpo.effective_start_date AND asgpo.effective_end_date
         AND SYSDATE BETWEEN asgpr.effective_start_date AND asgpr.effective_end_date
         AND SYSDATE BETWEEN poall_apprv.effective_start_date
                         AND poall_apprv.effective_end_date
         AND SYSDATE BETWEEN asgpo_apprv.effective_start_date
                         AND asgpo_apprv.effective_end_date
         AND prda.distribution_id = poda_apprv.req_distribution_id
         AND poha_apprv.po_header_id = poda_apprv.po_header_id
         AND poph_apprv.employee_id = poall_apprv.person_id
         AND poall_apprv.person_id = asgpo_apprv.person_id
         AND asgpo_apprv.grade_id = grdpo_apprv.grade_id(+)
         AND poha_apprv.po_header_id = poph_apprv.object_id
         AND poph_apprv.object_type_code = 'PO'
         AND poph_apprv.action_code = 'APPROVE'
    ORDER BY 4, 10, 14the calcuation works fine except for when order by clause is inlcuded
    kindly help
    Edited by: makdutakdu on Jun 1, 2010 2:51 PM

    hi Alex,John
    even i am confused as to why its happening ,
    SELECT   porh.segment1,
             CASE
                WHEN popr.action_code = 'APPROVE'
                AND prall.full_name <> 'Sudheer T. Paraputhra'
                AND grdpr.short_name < 'PS-10'------------< 'PS-10'
                   THEN prall.full_name
             END directman_pr,
             porh.description, porl.line_num,
             CASE
                WHEN popr.action_code = 'APPROVE'
                AND prall.full_name <> 'Sudheer T. Paraputhra'
                AND grdpr.short_name < 'PS-10'
                AND poph.action_code = 'SUBMIT'
                   THEN TO_NUMBER (  TO_CHAR (  TO_DATE ('1', 'J')
                                              + (  poph.action_date
                                                 - popr.action_date
                                              'J'
                                   - 1
             END days_pr,
             poha.segment1 po_num, prall.full_name pr_approved_by,
             popr.action_date pr_approved_date,
             CASE
                WHEN poall_apprv.full_name <> 'Sudheer T. Paraputhra'
                AND grdpo_apprv.short_name < 'PS-10'
                AND poph_apprv.action_code = 'APPROVE'
                AND poph.action_code = 'SUBMIT'
                   THEN TO_NUMBER (  TO_CHAR (  TO_DATE ('1', 'J')
                                              + (  poph_apprv.action_date
                                                 - poph.action_date
                                              'J'
                                   - 1
             END days_po,
             popr.sequence_num pr_seq, popr.action_code pr_action,
             poall.full_name po_approved_by, poph.action_date po_approved_date,
             poph.sequence_num po_seq, poph.action_code po_action,
             poph_apprv.action_date po_approved_date_appr,
             poph_apprv.action_code apprv_action_code
        FROM po_requisition_headers_all porh,
             po_requisition_lines_all porl,
             po_req_distributions_all prda,
             po_distributions_all poda,
             po_headers_all poha,
             po_action_history popr,
             po_action_history poph,
             hr.per_all_people_f poall,
             hr.per_all_people_f prall,
             hr.per_all_assignments_f asgpo,
             hr.per_all_assignments_f asgpr,
             per_grades_vl grdpo,
             per_grades_vl grdpr,
             po_headers_all poha_apprv,
             po_distributions_all poda_apprv,
             po_action_history poph_apprv,
             hr.per_all_people_f poall_apprv,
             hr.per_all_assignments_f asgpo_apprv,
             per_grades_vl grdpo_apprv
       WHERE poph.employee_id = poall.person_id
         AND popr.employee_id = prall.person_id
         AND poall.person_id = asgpo.person_id
         AND prall.person_id = asgpr.person_id
         AND asgpr.grade_id = grdpr.grade_id(+)
         AND asgpo.grade_id = grdpo.grade_id(+)
         AND prda.distribution_id = poda.req_distribution_id
         AND poha.po_header_id = poda.po_header_id
         AND prda.requisition_line_id = porl.requisition_line_id
         AND porh.requisition_header_id = porl.requisition_header_id
         AND porh.requisition_header_id = popr.object_id
         AND poph.object_type_code = 'PO'
         AND poha.po_header_id = poph.object_id
         AND SYSDATE BETWEEN poall.effective_start_date AND poall.effective_end_date
         AND SYSDATE BETWEEN prall.effective_start_date AND prall.effective_end_date
         AND SYSDATE BETWEEN asgpo.effective_start_date AND asgpo.effective_end_date
         AND SYSDATE BETWEEN asgpr.effective_start_date AND asgpr.effective_end_date
         AND SYSDATE BETWEEN poall_apprv.effective_start_date
                         AND poall_apprv.effective_end_date
         AND SYSDATE BETWEEN asgpo_apprv.effective_start_date
                         AND asgpo_apprv.effective_end_date
         AND prda.distribution_id = poda_apprv.req_distribution_id
         AND poha_apprv.po_header_id = poda_apprv.po_header_id
         AND poph_apprv.employee_id = poall_apprv.person_id
         AND poall_apprv.person_id = asgpo_apprv.person_id
         AND asgpo_apprv.grade_id = grdpo_apprv.grade_id(+)
         AND poha_apprv.po_header_id = poph_apprv.object_id
         AND poph_apprv.object_type_code = 'PO'
    --AND PORH.SEGMENT1='6003' -------when i give a particular PR number it comes out correct even with the order by clause    
    AND poph_apprv.action_code = 'APPROVE'
    ORDER BY 4, 10, 14when the PORH.SEGMENT1 is commented in oorder to display days for all po/pr i get the error
    kindly help me
    or is there an alternate calculation to get the number of days
    my date is in the format of 4/29/2009 9:13:51 AM
    for my caluculation i ve just taken the dates as i require days only kindly help
    Edited by: makdutakdu on Jun 2, 2010 7:52 AM

  • Error 13641 - The Subnet prefix must be between the starting and ending values

    Hi All,
    I can honestly say hand on heart that this is the first time I have ever asked for help in a forum in over 15 years but this is doing my head in..
    I have a Sys Center 2012 R2 deployment..  VMM R2 up to RU3, Edge Cluster (2 hosts), Management Cluster (2 hosts), 2 x Production Compute Clusters (total of 20 hosts).  I have a HA Network Virt Gateway deployed on the edge cluster.
    All Hosts have the new DHCP install done and the RU3 SQL patch is completed as outlined in deployment manual.
    Everything had been running fine for some time after RU3 update...  I am experiencing an issue whereby I get the following error anytime I try and attach a NVGRE VM network to a VM, or when I try and migrate a VM with a NVGRE network attached to another
    host.
    Error (13641)
    The specified subnet prefix must be between the starting and ending values for the range.
    Starting value: 4
    Ending value: 30
    Recommended Action
    Specify a suitable subnet prefix.
    All subnets in the entire network are /24's so prefix isn't an issue.
    I can successfully attach a standard vm network but get the above error when working with NVRGE networks.. 
    Further to this, if I restart VMM the DHCP function to VM's with NVGRE networks doesn't get picked up until I trigger a change in config on the VM, then it will get IP and function as expected.
    I have checked all logs, there aren't any errors that I can see.
    get-netvirtualizationlookuprecord throws out VM's and PA's as expected, but again not until I manually interfere with the VM in question.
    Have any of you come across this before??  I want to check before I go rebuilding the PA network entirely and having to cleanup all existing VM networks to do it..
    Any help or guidance would be appreciated..
    Cheers
    Nathan

    I have seen this message before, "specify a suitable subnet prefix".
    In my case, the NVGRE policies were out of sync due to HW issues on several hosts.
    Here's some steps in order to troubleshoot/fix:
    run the following cmdlet: Get-SCVMHost | Read-SCVMhost -RunAsynchronously
    Check for any errors in the job log that refers to "Network Virtualization".
    If this doesn't help, a recycle of the VMM Management server should do a "hard refresh" of the NVGRE policies, and it might include a reboot of the nvgre hosts too.
    This solved the case in my situation.
    -kn 
    Kristian (Virtualization and some coffee: http://kristiannese.blogspot.com )

  • SOA-- Invoking OSB Service Getting Error :ORA-00084: global area must be PGA, SGA, or UGA

    Hello Friends,
    Really appreciate your help/inputs on the below Error Message encountered while running a Concurrent Program--using SOA:Same encountered in recently refreshed DEV instance, Can it be related to some Developement Instance Configuration related to SOA, as same working as expected in PROD.PLEASE ASSIST
    Need your inputs on the Error Message we are getting which Invoking OSB Service.
    "Error inside invoke_osb_service -> Error Code : -84Error Message :ORA-00084: global area must be PGA, SGA, or UGA "
    Can you please review and confirm if the same encountered before or assist on the same:
    XXFIN_AP_INVOICES_INT_IB_PKG.invoke_osb_service
    -- Define the SOAP request according the the definition of the web service being called
    l_soap_request := 
                '<?xml version = "1.0" encoding = "UTF-8"?>'
            || '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prox="http://OmnicareFinance/ProxyInput/">'
             ||   '<soapenv:Header/>'
             ||     '<soapenv:Body>'
             ||       '<prox:InboundProcess>'
             ||     '<Source_system>'||g_source_instance||'</Source_system>'
             ||     '<Run_mode>'||g_run_mode||'</Run_mode>'
             ||     '<Batch_key>'||g_batch_key||'</Batch_key>'
             ||     '<Request_id>'||g_request_id||'</Request_id>'
             ||     '<Invoice_Header_File_name>'||g_file_name||'</Invoice_Header_File_name>'
             ||     '<Invoice_Line_File_name>'||NULL||'</Invoice_Line_File_name>'
             ||     '<File_location>'||g_file_location||'</File_location>'
             ||       '</prox:InboundProcess>'
             ||     '</soapenv:Body>'
             ||   '</soapenv:Envelope>';
    Oracle Apps Log File
    -->Entering XXFIN_AP_INVOICES_INT_IB_PKG.invoke_osb_service
    -->   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    -->Response> status_code: "200"
    -->Response> reason_phrase: "OK"
    -->Response> http_version: "HTTP/1.1"
    -->Response From OSB: <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:prox="http://OmnicareFinance/ProxyInput/"/><soapenv:Body xmlns:prox="http://OmnicareFinance/ProxyInput/"><prox:InboundProcessResponse><status>E</status></prox:InboundProcessResponse></soapenv:Body></soapenv:Envelope>
    -->OSB Response: E
    -->Error inside invoke_osb_service -> Error Code : -84Error Message :ORA-00084: global area must be PGA, SGA, or UGA
    -->   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    -->Entering XXFIN_AP_INVOICES_INT_IB_PKG.capture_error_info
    THANKS
    ANKUR

    Hi..
    >
    # symptom: ORA-00381: cannot use both new and old parameters for buffer cache size specification
    # cause: Both db_block_buffers and db_cache_size parameters are defined in the init.ora (instance parameter file). The db_block_buffers parameter has been deprecated and has been maintained only for backward compatibility. The db_cache_size parameter is one of the size parameters which defines the size of the cache for buffers. These parameters cannot be combined. Setting this along with the Dynamic SGA parameters errors out.
    >
    For sga_target refer to [http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams193.htm#REFRN10256]
    which quotes
    >
    SGA_TARGET specifies the total size of all SGA components. If SGA_TARGET is specified, then the following memory pools are automatically sized:
    *Buffer cache (DB_CACHE_SIZE)
    * Shared pool (SHARED_POOL_SIZE)
    * Large pool (LARGE_POOL_SIZE)
    * Java pool (JAVA_POOL_SIZE)
    * Streams pool (STREAMS_POOL_SIZE)
    If these automatically tuned memory pools are set to non-zero values, then those values are used as minimum levels by Automatic Shared Memory Management. You would set minimum values if an application component needs a minimum amount of memory to function properly.
    >
    So, the what ever the value are set for the parameter will act as minimum value when sga_target is set.
    HTH
    Anand

  • ORA-01841 Converting SQL Server DateTime to Oracle Date

    I have Oracle 11gR2 x64 running on my Win7 Enterprise x64 personal system. I'm trying to convert the TSQL to create a database in SQL Server 2008 Express for my C# class to Oracle, and I've run into a "interesting" problem loading date data.
    The SQL Server 2008 TSQL InvoiceDate column in the Invoices table has datatype DATETIME:
    *[InvoiceDate] [datetime] NOT NULL,*
    which Oracle does not support. The Oracle InvoiceDate column in the MMAB_Invoices table has datatype DATE:
    InvoiceDate DATE NOT NULL,
    The fun begins with the TSQL INSERT statements (for example):
    INSERT [dbo].[Invoices] ([InvoiceID], [CustomerID], [InvoiceDate], [ProductTotal], [SalesTax], [Shipping], [InvoiceTotal]) VALUES (18, 20, CAST(0x00009CFD00000000 AS DateTime), 151.0000, 11.3300, 6.2500, 168.5800)
    As you can see, whoever wrote the load script thought it would be totally awesome to convert hex (binary?) data to generate a date, instead of using data readable by a human being.
    BTW, the date generated is 2010-01-13 00:00:00.000.
    After Reading The Fabulous Manual and searching the OTN Discussion Fora, what I came up with is
    INSERT INTO MMAB_Invoices (CustomerID, InvoiceDate, ProductTotal, SalesTax, Shipping, InvoiceTotal) VALUES (20, TO_DATE(UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')), 'YYYY-MM-DD HH:MI:SS'), 151.0000, 11.3300, 6.2500, 168.5800);
    which returned
    Error starting at line 846 in command:
    INSERT INTO MMAB_Invoices (CustomerID, InvoiceDate, ProductTotal, SalesTax, Shipping, InvoiceTotal) VALUES (20, TO_DATE(UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')), 'YYYY-MM-DD HH:MI:SS'), 151.0000, 11.3300, 6.2500, 168.5800)
    Error report:
    SQL Error: ORA-01841: (full) year must be between -4713 and +9999, and not be 0
    *01841. 00000 - "(full) year must be between -4713 and +9999, and not be 0"*
    **Cause: Illegal year entered*
    **Action: Input year in the specified range*
    The PK InvoiceID is automatically generated by a BEFORE INSERT trigger that uses a sequence.
    Suggestions?
    Thanks.
    P.S. Happy New Year!!!

    Your hex conversion is certainly not returning a date format:
    sql> select UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')) from dual;
    UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000'))
      ┐²To convert the hex number to decimal, simply use to_number:
    sql> select to_number('00009CFD00000000', 'xxxxxxxxxxxxxxxx') from dual;
    TO_NUMBER('00009CFD00000000','XXXXXXXXXXXXXXXX')
                                          1.7261E+14Now, before you can make any further calculations with that number, you need to know how it represents the date of 2010-01-13. Luckily, we've got Google nowadays. ;-)
    Sql server representation seems to be an 8 byte field. The first 4 bytes stores the number of days since SQL Server's epoch (1st Jan 1900). The second 4 bytes stores the number of milliseconds after midnight.
    sql> select to_number('00009CFD', 'xxxxxxxxxxxxxxxx') from dual;
    TO_NUMBER('00009CFD','XXXXXXXXXXXXXXXX')
                                       40189
    sql> select to_date('1900-01-01','yyyy-mm-dd') + 40189 from dual;
    TO_DATE('
    13-JAN-10So, the conversion would be something like this:
    sql> select to_date('1900-01-01','yyyy-mm-dd') + to_number(substr('00009CFD00000000',1,8), 'xxxxxxxx') + to_number(substr('00009CFD00000000',9,8), 'xxxxxxxx') / (24*60*60*1000) from dual;
    TO_DATE('
    13-JAN-10Note: Oracle DATE format specifies a datetime up to the second, whereas the sqlserver DATETIME format specifies a datetime up to the millisecond; if that precision is needed, use Oracle's TIMESTAMP instead.
    Note: using an internal representation is risky, implementation details may change. In this case, it seems pretty unlikely that Microsoft will ever change the datetime internal representation, since that would break lots and lots of code.
    Edited by: theoa on 2-jan-2012 9:14

  • [Sorted] ORA-01841 - date problem

    I must be doing something stupid here, but for the life of me, I can't work out what it is! I'm on 10.2.0.2
    I have a partitioned table that has partitions named PART_<YYYYMMDD> (eg. PART_20070618) or PART_MAX (for the catchall partition).
    I've written a query to try and find the partition that's greater than a specified date, so I can work out what partition to split in my partition upkeep procedure.
    (This is the test version of the query - in the procedure the table_name and the date comparison will be variables)
        SELECT 'PART_'||to_char(MIN(TO_DATE(SUBSTR(partition_name, 6), 'yyyymmdd')), 'yyyymmdd')
        FROM   (select partition_name
                from   all_tab_partitions
                WHERE  table_name = UPPER('task_archive')
                AND    partition_name <> 'PART_MAX')
        WHERE   TO_DATE(SUBSTR(partition_name, 6), 'yyyymmdd') > trunc(to_date('20070618', 'yyyymmdd'))This gives the error: ORA-01841: (full) year must be between -4713 and +9999, and not be 0
    However, taking off the last WHERE clause gives this:
        SELECT 'PART_'||to_char(MIN(TO_DATE(SUBSTR(partition_name, 6), 'yyyymmdd')), 'yyyymmdd')
        FROM   (select partition_name
                from   all_tab_partitions
                WHERE  table_name = UPPER('task_archive')
                AND    partition_name <> 'PART_MAX')
    'PART_'||TO_CHAR(MIN(TO_DATE(SUBSTR(PARTITION_NAME,6),'YYYYMMDD')),'YYYYMMDD')
    PART_20070604And the inner query gives this:
                select partition_name
                from   all_tab_partitions
                WHERE  table_name = UPPER('task_archive')
                AND    partition_name <> 'PART_MAX'
    PARTITION_NAME
    PART_20070604
    PART_20070611
    PART_20070618Can anyone spot what it is that I've done wrong, please?!

    Heh, yes, I did rewrite the query due to receiving the error initially. I've gone down the same route as you and couldn't get it to work.
    I've just pasted your query in and run it, and same error occurs. Then I thought perhaps it's a Toad-ism, somewhere, but sqlplus gives the same error:
    SQL>     SELECT 'PART_'|| to_char(MIN( part_date ), 'yyyymmdd')
      2      FROM   (select partition_name, TO_DATE(SUBSTR(partition_name, 6), 'yyyymmdd') part_Date
      3              from   all_tab_partitions
      4              WHERE  table_name = UPPER('task_archive')
      5              AND    partition_name <> 'PART_MAX')
      6      WHERE   part_date > to_date('20070618', 'yyyymmdd')
      7 
    SQL> /
        FROM   (select partition_name, TO_DATE(SUBSTR(partition_name, 6), 'yyyymmdd') part_Date
    ERROR at line 2:
    ORA-01841: (full) year must be between -4713 and +9999, and not be 0I'm pretty sure Oracle's rewriting the query somehow, but I'm not sure how to stop it, given that the materialize hint isn't working:
      1      SELECT 'PART_'|| to_char(MIN( part_date ), 'yyyymmdd')
      2      FROM   (select /*+ materialize */ partition_name, TO_DATE(SUBSTR(partition_name, 6), 'yyyymmdd')
      3              from   all_tab_partitions
      4              WHERE  table_name = UPPER('task_archive')
      5              AND    partition_name <> 'PART_MAX')
      6*     WHERE   part_date > to_date('20070618', 'yyyymmdd')
    SQL> /
        FROM   (select /*+ materialize */ partition_name, TO_DATE(SUBSTR(partition_name, 6), 'yyyymmdd')
    ERROR at line 2:
    ORA-01841: (full) year must be between -4713 and +9999, and not be 0

  • Administer User gives ORA-01841

    Hello,
    I'm using Apex 4.0.1 The database is Oracle XE (10g).
    I've managed multiple users in this workspace for almost a year.
    Recently, someone locked the Admin account for the workspace (the application workspace, not the INTERNAL workspace).
    I can Login to Apex_Admin using the Admin account for the INTERNAL workspace. I was attempting to unlock the application workspace Admin account. However, whenever I attempt to edit the application workspace Admin user in either Apex_Admin or in Apex, I receive the following error:
    ORA-01841 (full) year must be between -4713 and +9999
    Do you have any idea why Apex is returning this error?
    Thanks for checking
    Edited by: PhilMan2 on Jun 4, 2011 6:48 PM
    Edited by: PhilMan2 on Jun 5, 2011 12:19 PM

    I found a fix to the problem. It showed up in Apex 4.0.2
    When I searched for ORA-01841 on the APEX forum, I got nothing back. When I google'd the error code, I found this answer.
    I got the answer from oracle-and-apex.com
    ""Ever got a “ORA-01841: (full) year must be between -4713 and +9999, and not be 0″ Error when trying to edit an existing user in APEX Administration Panel (Manage Workspaces > Manage Developers and Users) ?
    The reason to this error can be a too large value in Manage Instance > Security > Account Password Lifetime (days). For example you can store there a number of 999999 days which is saved without any problems, but when trying to edit an user you get the ORA-01841 error message.
    This error occurs in APEX 4.0.2.*, reported as Bug in APEX Forum.
    Thanks Pascal for showing this error to me.""
    FIX: I changed the value of 'Account Password Lifetime' to 9999 (27+ years) and everything worked fine again.
    Edited by: PhilMan2 on Jun 5, 2011 12:21 PM

  • Application Express 4.0.1.00.03 -   ORA-01841 error when attempting to edit

    I am logged into a development workspace and am able to add new users in HOME|ADMINISTRATION|USERS but when I try to edit them afterward I get the following error:
    Application Express Users
    ORA-01841: (full) year must be between -4713 and 9999, and not be 0+
    Obviously APEX is looking for a date value and not finding it. Anyone else encounter this or know where to look to resolve this? I got the same error in APEX 4.0 so the patch didn't resolve this error. I've done some research in the tables but couldn't find anything that looked like a missing date value.
    I'm using an 11gR2 database on OEL 5.5 running in VBOX on my laptop.
    Thanks.
    Rob

    FIX:
    Cause
    The issue appears due to a problem with the PASSWORD_LIFE_TIME.
    Solution
    Using the apex_admin application, navigate to Home > Manage Service > Security then enter integer values for:
    * Account Password Lifetime (days) - enter 11688, for example
    Apply Changes.
    Looks like it is a bug in apex 4.0 which has also affected previous versions (known about since version 1.5)........

  • ORA-01841 when refreshing materialized view

    Hi,
    I have to upgrade my database from oracle 8.1.7.4 to 9.2.0.1.
    I have tested two ways to do it :
    1) I upgraded my database from 8i to 9i with the u0801070.sql script.
    2) I created an empty 9i database and then I exported the data from the 8i database and imported them to the 9i database.
    The two procedures worked fine.
    But now, when I try to refresh the mateiralized views with DBA Studio on the database upgraded via export/import, I obtain the error : ORA-01841.
    On the database upgraded via u0801070.sql, I don't have the problem.
    Why do I have this error ?
    Regards,
    Rachel TREBUCHET DANJOU

    Error: ORA 1841
    Text: (full) year must be between -4713 and +4713 / +9999
    Cause:
    Action:
    *** Important: The notes below are for experienced users - See Note 22080.1
    Explanation:
         Eg: In a clause like "to_date('XXXX','YYYY')" XXXX is outside of the
         range -4713 and +4713.
         Note that Year 0 is invalid too. See Bug 106242 for an explanation..
         Typically this involves "to_date('00','YYYY')" or similar which is
         invalid. It is probably better to use 'RR' rather than 'YY' which
         prefixes with an appropriate century.
         Eg:
              select to_char(to_date('00','yyyy')) from dual;
              ORA-01841: (full) year must be between -4713 and +4713
              select to_char(to_date('00','rr')) from dual;
              01-MAR-2000
    Year 2000
    ~~~~~~~~~
    You may also see this error if using a TO_DATE() function
    on a date column (or SYSDATE) and your sessions NLS_DATE_FORMAT
    includes a 2 digit year mask (RR or YY).
    eg: alter session set nls_date_format='DD-MON-RR';
    select to_date(sysdate,'DD-MON-YYYY') from dual;
    "ORA-01841: (full) year must be between -4713 and +9999, and not be 0"
    This is because TO_DATE() expects to work on a CHARACTER
    data type and so there is an implicit conversion from
    DATE to CHAR.
    eg: In the above example SYSDATE of 01-JAN-2000 is implictly
    converted to the character string "01-JAN-00", which is
    then converted back to a date using a DD-MON-YYYY date format.
    This gives a year of 0000 which is invalid, hence ORA-1841.
    Note:     From Oracle 7.2 onwards the UPPER bound is +9999 and not +4713
    Regards,
    Reza

  • ORA-01841

    Hi expert,
    I have two statement in my procedure :
    r_period IN VARCHAR2
    v_from_date date;
    v_to_date date;
    v_from_date := to_date('1/4/'||to_char(r_period),'dd/mm/yyyy');
    v_to_date := to_date('31/3/'||to_char((to_number(r_period)-5)),'dd/mm/yyyy');
    when I ran procedure , got following error message:
    "ORA-01841 :(full) year must be between -4713 and +9999, and not be 0 "
    appreciate very much if help me to resolve it.
    Many Thanks,

    Hi,
    I can't re-produce the problem.
    Whenever you have a problem, please post a complete test script that people can run to re-create the problem and test their ideas. In this case, include the complete procedure code (or a simplified version that has the same problem) and the code that you use to call it.
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}
    918440 wrote:
    Hi expert,
    I have two statement in my procedure :
    r_period IN VARCHAR2
    v_from_date date;
    v_to_date date;
    v_from_date := to_date('1/4/'||to_char(r_period),'dd/mm/yyyy');
    v_to_date := to_date('31/3/'||to_char((to_number(r_period)-5)),'dd/mm/yyyy');Usuaully, when people talk about dates "from x to y", x is earlier than y. You're setting v_from_date to be over 5 years later than v_to_date. That's not the cause of the ORA-01841 error, or any other Oracle error, but it is likely to confuse whoever has to maintain this code.
    when I ran procedure , got following error message:
    "ORA-01841 :(full) year must be between -4713 and +9999, and not be 0 "That's one of those error messages that actually means what it says. Apparantly, you're calling the procedure with a bad value for r_period. I can't say anthing more specific until you post a complete script.
    Converting from NUMBERs to VARCHAR2s to DATEs is very error prone. Try to avoid doing so many conversions. For example, you're doing 3 data type conversions to compute v_from_date. You could get the same results with only 1 conversion, like this:
    v_to_date   := ADD_MONTHS ( TO_DATE ( '31/3/' || r_period
                                              , 'DD/MM/YYYY'
                     , -5 * 12
                        );Personally, I would do it this way:
    v_to_date   := ADD_MONTHS ( TRUNC ( TO_DATE (r_period, 'YYYY')
                          , 'YEAR'
                          ) - 1
                     , -57
                        );which also uses only 1 conversion, and that conversion is very simple. You can still get errors, including ORA-01841, if you pass a bad value for r_period, but the errors will be easier to find and fix.

  • ORA-02069: global_names parameter must be set to TRUE for this operation

    I have 10g database and a schema 'TMAPP'
    And I have two table in TMAPP as
    create table user_menu_privs
    company_code           varchar2(5),
    bu_code      varchar2(12),
    user_group      varchar2(30),
    user_group_type      varchar2(1),
    menu_option_code number(5),
    enabled varchar2(1),
    query_only varchar2(1),
    default_lang varchar2(3),
    created_by      varchar2(10),
    created_on      date,
    updated_by      varchar2(10),
    updated_on      date,
    constraint pk_user_menu_privs primary key (company_code,bu_code,user_group,user_group_type,menu_option_code),
    constraint fk_user_menu_privs foreign key (company_code,bu_code,user_group,user_group_type)
    references user_group(company_code,bu_code,user_group,user_group_type)
    create table user_dst
    company_code           varchar2(5),
    bu_code      varchar2(12),
    userid varchar2(10),
    user_group      varchar2(30) ,
    user_group_type      varchar2(1) ,
    font_size      number(2) ,
    font_name      varchar2(100) ,
    address_id number(10),
    created_by      varchar2(10),
    created_on      date,
    updated_by      varchar2(10),
    updated_on      date,
    constraint pk_user_dst primary key (company_code,bu_code,userid,user_group,user_group_type),
    constraint fk_user_dst foreign key (company_code,bu_code,user_group,user_group_type)
    references user_group(company_code,bu_code,user_group,user_group_type)
    I have another database 11g with a schema TMAPP.
    Here I have created a database link 'to_dev' is connecting to the 10g db
    using this I can connect and see the data from 10g TMAPP
    I have created two views
    create or replace view user_menu_privs as
    select *
    from user_menu_privs@to_dev
    where user_group in
    (select user_group from user_dst
    where user_group_type='F');
    create or replace view user_dst as
    select * from user_dst@to_dev;
    and I executed
    delete from user_menu_privs
    where menu_option_code=108;
    I am getting the error
    ORA-02069: global_names parameter must be set to TRUE for this operation
    after that I set the global_names in 11g as TRUE
    then I am getting another error as
    ORA-02085: database link TO_DEV connects to DEV.REGRESS.RDBMS.DEV.US.ORACLE.COM -- that means link is not wokring
    Please help
    Dennis
    Edited by: DJ on Mar 13, 2012 5:49 AM
    Edited by: DJ on Mar 13, 2012 5:51 AM
    Edited by: DJ on Mar 13, 2012 5:53 AM
    Edited by: DJ on Mar 13, 2012 5:55 AM
    Edited by: DJ on Mar 13, 2012 5:56 AM

    OP wrote
    >
    But you said
    create a database link in 11g database with 11g database global name and put 11g database global_name=true.
    and put 10g database golba_name=false;
    >
    That isn't what I said at all. Reread my first reply. The first part is a copy of what you had stated.
    >
    ORA-02069: global_names parameter must be set to TRUE for this operation
    after that I set the global_names in 11g as TRUE
    >
    And then I said
    >
    That is because when global_names is TRUE, the database link name MUST be same as the global db name of the database to which the link connects to.
    You need to drop the database link and recreate it using the global name of the database it connects to.
    'link name MUST be same as the global db name of the database to which the link connects to.' - I didn't say 11g.
    And I didn't say 'put 11g database global_name=true' because you had already done that! 'after that I set the global_names in 11g as TRUE.
    1. 11g - global_names MUST be TRUE
    2. 11g - database link name MUST be the same as the global db name of the database to which the link connects to - 10g global db name
    3. 10g - gloibal_names setting is irrelevant

  • ORA-27475: "DBREPORT.GATEKEEPER_JOB" must be a job

    Hi All,
    When ever i am calling the below from a procedure i am getting the error,ORA-27475: "DBREPORT.GATEKEEPER_JOB" must be a job.
    I am getting this error in first drop box it self in(DBMS_SCHEDULER.DROP_JOB ).
    Please help.
    DBMS_SCHEDULER.DROP_JOB
                                   job_name   => 'Gatekeeper_Job',
                                   force  => TRUE,
                                   commit_semantics   => 'STOP_ON_FIRST_ERROR'
                             DBMS_SCHEDULER.create_job (
                              job_name              => 'Gatekeeper_Job',
                              job_type              => 'EXECUTABLE',
                              job_action            => '/home/cobr_sftp/var/controllingload/download/transfer_gatekeeper.sh',
                               number_of_arguments   => 4, 
                             -- auto_drop             => true,
                               enabled               => FALSE,
                              comments              => 'CREATE_PROGRAM test using a schell script'
                           DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
                            job_name                => 'Gatekeeper_Job',
                            argument_position           => 1,
                            argument_value          => ip_d_filename              );
                            DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
                            job_name                => 'Gatekeeper_Job',
                            argument_position           => 2,
                            argument_value          => v_ftype                          );                      
                            DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
                            job_name                => 'Gatekeeper_Job',
                            argument_position           => 3,
                            argument_value          => v_d_db_name          );
                            DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
                            job_name                => 'Gatekeeper_Job',
                            argument_position           => 4,
                            argument_value          => v_sendoraddress      );
                            DBMS_SCHEDULER.enable ('Gatekeeper_Job');Edited by: user11942774 on Oct 21, 2012 6:30 PM

    Then you could be hitting this bug. See the end of this thread
    Unable to drop the dbms_scheduler job using "dbms_scheduler.drop_job"

  • Object name must have between 000003 and 000009 characters

    Hi BW Experts,
    When I am trying to create a cube I am getting the below error message:
    Object name Z0FIGL_01 must have between 000003 and 000009 characters. Message no. R7112
    It would be great if some one can help me to resolve the issue...
    Regards,
    Reddy

    Hi
    The infocube technical name must be in between 3 to 9 characteristics length
    i.e,Min 3 Char & Max 9 Char
    is ZOFIGL_01 is ur object name ?its defined within limits,need to verify:)
    hope this helps
    Sriman
    Edited by: Sreeman on Apr 11, 2008 9:34 PM

Maybe you are looking for

  • No sound when playing DVDs, yet fine with bluray

    my sony bluray does not have sound when playing dvds. it acts fine when using blu ray. any suggestions?

  • Why can't i see my files when i connect to my lcd projector?

    after i upgraded to Yosemite, i connected my laptop to my projector using the apple adapter. once i connected the only thing i could see was the picture i have on my desktop. I couldn't see any of my files or folders. when i opened a web browser, i c

  • Borderless problem when printing with HP Photosmart K510A

    help me with this one HP support is closed today, are you experiencing this borderless problem if printing bordless a part of the image gets cut off when printing right now I'm printing in 4R the when I "print preview" the image is not cut off but wh

  • Having trouble publishing iWeb

    I'm getting an error saying: There was an error communicating with the FTP server. Try again later, or check with your service provider.  I've had this once before but I don't remember what I did to solve it.  Any help would be appreciated.  I am on

  • IMac crashed while updating today and I can't find my reboot disk

    Hello, I have an iMac that was purchased Feb 2014 and when it was trying to install the latest update today (March 12, 2015) it crashed.  Like, I can't get it to boot at all. unless I have the reboot disk.  The problem is, I can't find my reboot disk