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

Similar Messages

  • 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.

  • 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

  • Crystal preview - A subscript must be between 1 and the size of the array..

    Hi
    I am getting the following error when I run Print Preview on the CR Sales Invoice:
    "A subscript must be between 1 and the size of the array ........."
    Any ideas?
    Thanks
    Ian

    Thanks Gordon
    However this is a fresh install and the default Crystal SI layout provided by SAP and I would have expected it to work.  It makes it seem like an installation problem.
    Do you know where the *.rpt files as stored by SAP and where I could maybe get a new Crystal SI to test?
    Thanks

  • 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

  • ORA-1850: hor must be between 0 and 23 error

    Hi All
    i have the following table for creating and inserting i included only two fileds as these are the fields that i'm getting errors on.
    WITH     sample_data     AS
         SELECT     '50709' AS start_date, '2400' AS start_time  FROM dual     UNION ALL
         SELECT     '082510',              '0000'                  FROM dual
    SELECT       *
    FROM       sample_data
    ;DATA:
    START_DATE     START_TIME
    50709                        2400
    082510                        0000And now when i run the query against the table:
    SELECT   direction, car_count_pos, truck_count_pos,
             (car_count_pos + 2 * (truck_count_pos)) AS adjusted, car_count_neg,
             truck_count_neg,
             (car_count_neg + 2 * (truck_count_neg)) AS adjusted_neg,
             TO_DATE (start_date, 'MMDDYY') AS start_date,
             TO_DATE (end_date, 'MMDDYY') AS end_date,
             ROUND (TO_CHAR (TO_DATE (LPAD (start_time, 4, '0'), 'HH24MI'),
                             'HH24.MI'
                   ) AS start_time,
             start_time,
             (TO_DATE (end_date, 'MMDDYY') - TO_DATE (start_date, 'MMDDYY')
             ) AS days
        FROM (SELECT   (CASE
                           WHEN t1.direction = '1'
                              THEN (  COUNT (t1.bin_1_data)
                                    + COUNT (t1.bin_2_data)
                                    + COUNT (t1.bin_3_data) * 0.981 * 1.019
                           ELSE NULL
                        END
                       ) AS car_count_pos,
                       t1.direction,
                       (CASE
                           WHEN t1.direction = '1'
                              THEN (  COUNT (t1.bin_4_data)
                                    + COUNT (t1.bin_5_data)
                                    + COUNT (t1.bin_6_data)
                                    + COUNT (t1.bin_7_data)
                                    + COUNT (t1.bin_8_data)
                                    + COUNT (t1.bin_9_data)
                                    + COUNT (t1.bin_10_data)
                                    + COUNT (t1.bin_11_data)
                                    + COUNT (t1.bin_12_data)
                                    + COUNT (t1.bin_13_data)
                                    + COUNT (t1.bin_14_data)
                                    + COUNT (t1.bin_15_data) * 0.981 * 1.019
                           ELSE NULL
                        END
                       ) AS truck_count_pos,
                       (CASE
                           WHEN t1.direction = '3'
                              THEN (  COUNT (t1.bin_1_data)
                                    + COUNT (t1.bin_2_data)
                                    + COUNT (t1.bin_3_data) * 0.981 * 1.019
                           ELSE NULL
                        END
                       ) AS car_count_neg,
                       (CASE
                           WHEN t1.direction = '3'
                              THEN (  COUNT (t1.bin_4_data)
                                    + COUNT (t1.bin_5_data)
                                    + COUNT (t1.bin_6_data)
                                    + COUNT (t1.bin_7_data)
                                    + COUNT (t1.bin_8_data)
                                    + COUNT (t1.bin_9_data)
                                    + COUNT (t1.bin_10_data)
                                    + COUNT (t1.bin_11_data)
                                    + COUNT (t1.bin_12_data)
                                    + COUNT (t1.bin_13_data)
                                    + COUNT (t1.bin_14_data)
                                    + COUNT (t1.bin_15_data) * 0.981 * 1.019
                           ELSE NULL
                        END
                       ) AS truck_count_neg,
                       t2.start_date, t2.start_time, t2.end_date, t2.end_time
                  FROM bin_data t1, traffic_sample t2
                 WHERE t1.traffic_sample_id = t2.traffic_sample_id
              GROUP BY t1.direction,
                       t2.start_date,
                       t2.start_time,
                       t2.end_date,
                       t2.end_time)
       WHERE direction IN ('1', '3')
    GROUP BY TO_DATE (start_date, 'MMDDYY'),
             direction,
             car_count_pos,
             truck_count_pos,
             (car_count_pos + 2 * (truck_count_pos)),
             truck_count_neg,
             (car_count_neg + 2 * (truck_count_neg)),
             TO_DATE (end_date, 'MMDDYY'),
             ROUND (TO_CHAR (TO_DATE (LPAD (start_time, 4, '0'), 'HH24MI'),
                             'HH24.MI'
             start_time,
             car_count_negI'm getting the error
    ORA-1850: Hour must be between 0 and 23
    But as you see there is a value 2400 in the table is there any way to get around this? please need help.
    Thanks
    Edited by: thinkingeye on Aug 26, 2010 8:42 AM

    Thanks AP but i came up with something different which i guess sserved the same purpose i used the DECODE fucntion in the INNER query.
    SELECT   direction, car_count_pos, truck_count_pos,
             (car_count_pos + 2 * (truck_count_pos)) AS adjusted, car_count_neg,
             truck_count_neg,
             (car_count_neg + 2 * (truck_count_neg)) AS adjusted_neg,
             TO_DATE (start_date, 'MMDDYY') AS start_date,
             TO_DATE (end_date, 'MMDDYY') AS end_date,
             ROUND (TO_CHAR (TO_DATE (LPAD (start_time, 4, '0'), 'HH24MI'),
                             'HH24.MI'
                   ) AS start_time,
                   ROUND (TO_CHAR (TO_DATE (LPAD (end_time, 4, '0'), 'HH24MI'),
                             'HH24.MI'
                   ) AS end_time,
             start_time,
             (TO_DATE (end_date, 'MMDDYY') - TO_DATE (start_date, 'MMDDYY')
             ) AS days,
             CITY,COUNTY,LOCATION,ROUTE_NBR,ROUTE_TYPE
        FROM (SELECT   (CASE
                           WHEN t1.direction = '1'
                              THEN (  COUNT (t1.bin_1_data)
                                    + COUNT (t1.bin_2_data)
                                    + COUNT (t1.bin_3_data) * 0.981 * 1.019
                           ELSE NULL
                        END
                       ) AS car_count_pos,
                       t1.direction,
                       (CASE
                           WHEN t1.direction = '1'
                              THEN (  COUNT (t1.bin_4_data)
                                    + COUNT (t1.bin_5_data)
                                    + COUNT (t1.bin_6_data)
                                    + COUNT (t1.bin_7_data)
                                    + COUNT (t1.bin_8_data)
                                    + COUNT (t1.bin_9_data)
                                    + COUNT (t1.bin_10_data)
                                    + COUNT (t1.bin_11_data)
                                    + COUNT (t1.bin_12_data)
                                    + COUNT (t1.bin_13_data)
                                    + COUNT (t1.bin_14_data)
                                    + COUNT (t1.bin_15_data) * 0.981 * 1.019
                           ELSE NULL
                        END
                       ) AS truck_count_pos,
                       (CASE
                           WHEN t1.direction = '3'
                              THEN (  COUNT (t1.bin_1_data)
                                    + COUNT (t1.bin_2_data)
                                    + COUNT (t1.bin_3_data) * 0.981 * 1.019
                           ELSE NULL
                        END
                       ) AS car_count_neg,
                       (CASE
                           WHEN t1.direction = '3'
                              THEN (  COUNT (t1.bin_4_data)
                                    + COUNT (t1.bin_5_data)
                                    + COUNT (t1.bin_6_data)
                                    + COUNT (t1.bin_7_data)
                                    + COUNT (t1.bin_8_data)
                                    + COUNT (t1.bin_9_data)
                                    + COUNT (t1.bin_10_data)
                                    + COUNT (t1.bin_11_data)
                                    + COUNT (t1.bin_12_data)
                                    + COUNT (t1.bin_13_data)
                                    + COUNT (t1.bin_14_data)
                                    + COUNT (t1.bin_15_data) * 0.981 * 1.019
                           ELSE NULL
                        END
                       ) AS truck_count_neg,
                       t2.start_date, t2.start_time, t2.end_date,*decode(t2.END_TIME,2400,'2359',t2.end_time) as end_time*,t3.CITY, t3.COUNTY,t3.LOCATION,t3.ROUTE_NBR, t3.ROUTE_TYPE
                  FROM bin_data t1, traffic_sample t2,location_details t3
                 WHERE t1.traffic_sample_id = t2.traffic_sample_id
                 and t2.TRAFFIC_SAMPLE_ID=t3.TRAFFIC_SAMPLE_ID
              GROUP BY t1.direction,
                       t2.start_date,
                       t2.start_time,
                       t2.end_date,
                       t2.end_time,
                       t3.CITY, t3.COUNTY,t3.LOCATION,t3.ROUTE_NBR, t3.ROUTE_TYPE)
       WHERE direction IN ('1', '3')
    GROUP BY TO_DATE (start_date, 'MMDDYY'),
             direction,
             car_count_pos,
             truck_count_pos,
             (car_count_pos + 2 * (truck_count_pos)),
             truck_count_neg,
             (car_count_neg + 2 * (truck_count_neg)),
             TO_DATE (end_date, 'MMDDYY'),
             ROUND (TO_CHAR (TO_DATE (LPAD (start_time, 4, '0'), 'HH24MI'),
                             'HH24.MI'
             start_time,
             car_count_neg,
             end_time,
             CITY,COUNTY,LOCATION,ROUTE_NBR,ROUTE_TYPE

  • Help Needed: Facing the error ORA-01406: fetched column value was truncated

    Hi Everyone,
    When I run a particular PL/SQL query using Oracle 9i ODBC driver, it is working fine and fetching me the desired results.
    However, when I run the same query using the Oracle 10g ODBC driver, I am getting the error: ORA-01406: fetched column value was truncated.
    I have checked all the fields of the table and they are well within the allowable limit.
    Can you please let us know what needs to be done to resolve this issue?
    Thanks and Regards,
    Sudhindra

    Well it's obviously a problem with the client software. Doesn't Datastage have some way of configuring these things?
    rgds, APC

  • Error: ORA-01847: day of month must be between 1 and last day of month

    Hi,
    I am getting this ORA-01847: day of month must be between 1 and last day of month type of error but I have checked my data all are correct.
    I am inserting the data in the merge query. It is giving the above error.
    but when i insert the data like that
    insert into dt(start_date) select TO_DATE (tariff_start_date, 'DD/MM/RRRR') from ext_zpp0a871;
    It does not give any error.
    Please find the below code
    DECLARE
    l_sv_error_msg VARCHAR2 (1000);
    BEGIN
    FOR i IN (SELECT condition_type, sales_org, division_channel, division,
    price_list, ean_upc, amount, unit_of_measure1,
    tariff_start_date, tariff_end_date
    FROM ext_zpp0a871--This is external table
    WHERE condition_type = 'ZPP0' AND ROWNUM < 200)
    LOOP
    BEGIN
    MERGE INTO sap_tariff st
    USING (SELECT i.price_list pl, i.ean_upc upc,
    TO_DATE (i.tariff_start_date, 'DD/MM/RRRR') tsd,
    TO_DATE (i.tariff_end_date, 'DD/MM/RRRR') ted
    FROM DUAL) du
    ON (st.prod_ean_cuni = du.upc
    AND st.pricelist = du.pl
    AND st.tariff_start_date = du.tsd
    AND st.tariff_end_date = du.ted)
    WHEN MATCHED THEN
    UPDATE
    SET st.condition_type = i.condition_type,
    st.sales_org = i.sales_org,
    st.division_channel = i.division_channel,
    st.division = i.division,
    st.amount =
    TO_NUMBER (REPLACE (REPLACE (i.amount, '.', NULL),
    st.uom = i.unit_of_measure1
    WHEN NOT MATCHED THEN
    INSERT (condition_type, sales_org, division_channel, division,
    pricelist, prod_ean_cuni, amount, uom,
    tariff_start_date, tariff_end_date)
    VALUES (i.condition_type, i.sales_org, i.division_channel,
    i.division, i.price_list, i.ean_upc,
    TO_NUMBER (REPLACE (REPLACE (i.amount, '.', NULL),
    i.unit_of_measure1,
    TO_DATE (i.tariff_start_date, 'DD/MM/RRRR'),
    TO_DATE (i.tariff_end_date, 'DD/MM/RRRR'));
    /*INSERT INTO sap_tariff
    (condition_type, sales_org, division_channel,
    division, pricelist, prod_ean_cuni,
    amount,
    uom,
    tariff_start_date,
    tariff_end_date
    VALUES (i.condition_type, i.sales_org, i.division_channel,
    i.division, i.price_list, i.ean_upc,
    TO_NUMBER (REPLACE (REPLACE (i.amount, '.', NULL),
    i.unit_of_measure1,
    TO_DATE (i.tariff_start_date, 'DD/MM/RRRR'),
    TO_DATE (i.tariff_end_date, 'DD/MM/RRRR')
    EXCEPTION
    WHEN DUP_VAL_ON_INDEX
    THEN
    UPDATE sap_tariff
    SET condition_type = i.condition_type,
    sales_org = i.sales_org,
    division_channel = i.division_channel,
    division = i.division,
    amount =
    TO_NUMBER (REPLACE (REPLACE (i.amount, '.', NULL),
    uom = i.unit_of_measure1;
    WHEN OTHERS
    THEN
    l_sv_error_msg := SQLERRM (SQLCODE);
    INSERT INTO sap_tariff_log
    (date_of_load, condition_type, sales_org,
    division_channel, division, price_list,
    prod_ean_cuni, amount, uom,
    tariff_start_date, tariff_end_date,
    rejection_reason
    VALUES (SYSDATE, i.condition_type, i.sales_org,
    i.division_channel, i.division, i.price_list,
    i.ean_upc, i.amount, i.unit_of_measure1,
    i.tariff_start_date, i.tariff_end_date,
    l_sv_error_msg
    END;
    END LOOP;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_sv_error_msg := SQLERRM (SQLCODE);
    neo_pro_log ('Others Error', l_sv_error_msg);
    END;

    user13400510 wrote:
    but when i insert the data like that
    insert into dt(start_date) select TO_DATE (tariff_start_date, 'DD/MM/RRRR') from ext_zpp0a871;
    It does not give any error.Maybe the error is on tariff_end_date instead of tariff_start_date ?
    What are the datatypes of tariff_start_date and tariff_end_date ? If they are already dates, and you to_date them (and depending on what your nls_date_xxxxx params are) you can have such errors :SQL> sho parameter nls_date_format
    NAME_COL_PLUS_SHOW_PARAM                 TYPE        VALUE_COL_PLUS_SHOW_PARAM
    nls_date_format                          string      DD/MM/YYYY
    SQL> select to_date(sysdate,'Day dd Mon RRRR') from dual;
    select to_date(sysdate,'Day dd Mon RRRR') from dual
    ERROR at line 1:
    ORA-01846: not a valid day of the week
    SQL> select to_date(sysdate,'hh24:mi:ss dd/mm/rrrr') from dual;
    select to_date(sysdate,'hh24:mi:ss dd/mm/rrrr') from dual
    ERROR at line 1:
    ORA-01850: hour must be between 0 and 23

  • ORA-01847: day of month must be between 1 and last day of month error

    Hi All
    When i run the following code i'm getting the error:ORA-01847: day of month must be between 1 and last day of month error
    SELECT t2.owner_cat,
    t1.owner_id,
    stock_id,
    Sum(received_amount) received_amount,
    Sum(curr_amount) curr_amount,
    Sum(used_amount) used_amount,
    To_char(Add_months(date_work,6),'YYYY') date_work
    FROM (SELECT owner_id_to owner_id,
    stock_id_to stock_id,
    Sum(full_amount) received_amount,
    0 curr_amount,
    0 used_amount,
    To_char(0) date_work
    FROM dw_wms_mat_transfer
    WHERE master_code_id IN ('8664','8665')
    GROUP BY owner_id_to,
    stock_id_to
    UNION ALL
    SELECT owner_id,
    stock_id,
    0 received_amount,
    Sum(curr_amount) curr_amount,
    0 used_amount,
    To_char(0) date_work
    FROM dw_wms_mat_inv
    WHERE master_code_id IN ('8664','8665')
    GROUP BY owner_id,
    stock_id
    UNION ALL
    SELECT t2.owner_id,
    t1.stock_id,
    0 received_amt,
    0 curr_amt,
    Sum(amount) used_amt,
    To_char(Add_months(date_work,6),'YYYY') date_work
    FROM dw_wms_wo_mat_dc t1,
    (SELECT owner_id,
    stock_id
    FROM dw_wms_mat_inv
    WHERE master_code_id IN ('8664','8665')
    GROUP BY owner_id,
    stock_id) t2
    WHERE t1.stock_id = t2.stock_id
    GROUP BY t2.owner_id,
    t1.stock_id,
    To_char(Add_months(date_work,6),'YYYY')) t1,
    dw_wms_setup_owner t2
    WHERE t1.owner_id = t2.owner_id
    GROUP BY t2.owner_cat,
    t1.owner_id,
    stock_id,
    To_char(Add_months(date_work,6),'YYYY')
    But when i just run the inner query:
    (SELECT owner_id_to owner_id,
    stock_id_to stock_id,
    Sum(full_amount) received_amount,
    0 curr_amount,
    0 used_amount,
    To_char(0) date_work
    FROM dw_wms_mat_transfer
    WHERE master_code_id IN ('8664','8665')
    GROUP BY owner_id_to,
    stock_id_to
    UNION ALL
    SELECT owner_id,
    stock_id,
    0 received_amount,
    Sum(curr_amount) curr_amount,
    0 used_amount,
    To_char(0) date_work
    FROM dw_wms_mat_inv
    WHERE master_code_id IN ('8664','8665')
    GROUP BY owner_id,
    stock_id
    UNION ALL
    SELECT t2.owner_id,
    t1.stock_id,
    0 received_amt,
    0 curr_amt,
    Sum(amount) used_amt,
    To_char(Add_months(date_work,6),'YYYY') date_work
    FROM dw_wms_wo_mat_dc t1,
    (SELECT owner_id,
    stock_id
    FROM dw_wms_mat_inv
    WHERE master_code_id IN ('8664','8665')
    GROUP BY owner_id,
    stock_id) t2
    WHERE t1.stock_id = t2.stock_id
    GROUP BY t2.owner_id,
    t1.stock_id,
    To_char(Add_months(date_work,6),'YYYY'))
    I'm not getting that error, any help please?

    Hi,
    Like Anuraq already explained, you need to keep in mind that when you apply a to_char, you've turned your DATE datatype into a STRING and by doing that you've lost the ability to use the add_months function again in your outer query.
    Using a simplified example, extracted from your example:
    MHO%xe> select to_char(add_months(date_work, 6), 'yyyy') date_work
      2  from ( select to_char(0) date_work
      3         from dual
      4         union all
      5         select to_char(0) date_work
      6         from dual
      7         union all
      8         select to_char(add_months(sysdate, 6), 'yyyy') date_work
      9         from dual
    10       );
    select to_char(add_months(date_work, 6), 'yyyy') date_work
    FOUT in regel 1:
    .ORA-01847: day of month must be between 1 and last day of monthHowever, you should either do something like:
    MHO%xe> select nvl(to_char(add_months(date_work, 12), 'yyyy'), '0') date_work
      2  from ( select to_date(null) date_work
      3         from dual
      4         union all
      5         select to_date(null) date_work
      6         from dual
      7         union all
      8         select sysdate date_work
      9         from dual
    10       );
    DATE
    0
    0
    2010or (less clear, more confusing):
    MHO%xe> select nvl(to_char(add_months(date_work, 6), 'yyyy'), '0') date_work
      2  from ( select to_date(null) date_work
      3         from dual
      4         union all
      5         select to_date(null) date_work
      6         from dual
      7         union all
      8         select add_months(sysdate, 6) date_work
      9         from dual
    10       );
    DATE
    0
    0
    2010It's not clear to me why you're using add_months twice (inner + outer query) in your original example.
    As you can see you can get the same results using it only once in your outer query.

  • Error Logging and notifying users regarding the errors

    Hi..
    we are designing a workflow in which if any user comes across an error (at any branch or while executing an action) must be alerted with the error and must send a notification to the admin that the process has stalled at that particular part of the workflow due to some error.
    my doubts are
    1.how can we notify the admin and the initiator of the workflow regarding the error a particular user gets.i saw in adminui that there are two tabs for the admin to view the stalled actions/stalled branches.but the admin and the user needs to be notified with an alert or email that a particular action has been stalled.
    i think i conveyed my problem in a correct manner.if its confusing then plz tell me coz i am already confused in this..

    Thank you sir for your immediate response of the query.
    In the workflow which we are designing,a service request from filled by the user will be routed to the particular approver and he inturn will approve/reject the form accordingly.once he approves,the form is routed to the service provider who will fulfill the service requested and approved.
    1.Now,for instance suppose that the workflow gets stalled while the form is with the approver.my question is how to notify the user that the service he requested is delayed due to the stalling of the process in between as well as the admin alerting him with the error which stalled the workflow process.
    2.you said that it is easy to setup an email address within the adminui..but i dont know how to do that as i am a beginner.
    3.Also u asked me to specify the errors for which we need to send alerts and email notifications...whatever error that occurs whenever the workflow gets staleld needs to be notified both to the user and the admin (as per our requirements).it would be helpful to us if u give a solution for this.
    thank you..
    Raghava Kumar V.S.S.

  • How to fix the error ORA-02289 using msync.exe for WIN32

    Hi All,
    I am testing OLITE 10.3.0.1.0 and I got the error Ora-02289 when I am synchronizing
    any idea to fix it?
    Regards.
    Charly

    Hi,
    The Mobile Manager Didn't delete/create properly the mobile user.
    The Mobile Manager is an J2EE Application which connects to the Mobile Repository using the Oracle JDBC Thin Driver, it is possible that when some users were deleted/created, the http connection or JDBC connection was cut.
    Can you try to reset the metadata cache, delete the mobile user, create and configure this mobile user then Synchronize it.
    It will make a Complete refresh but it should synchronize fine after.
    Regards.
    Marc

  • RMAN backup restore leads to the error "ORA-00600: internal error code, arguments: [kccsbck_first], [2], [2349545192]" on DB startup

    Hi All,
    DB:11.2.0.3.0
    OS: Sun Solaris SPARC 64 bits
    I am facing an issue -  RMAN backup restore leads to the error "ORA-00600: internal error code, arguments: , , " on DB startup. Restored from RMAN backup DB test2 to DB test1.
    <p mcekeep="true">  $ sqlplus / as sysdba
    <p mcekeep="true">   SQL*Plus: Release 11.2.0.3.0   Production on Sun Oct 6 09:31:28 2013
    <p mcekeep="true">   Copyright (c) 1982, 2011,   Oracle.  All rights reserved.
    <p mcekeep="true">   Connected to an idle instance.
    <p mcekeep="true">  
    SQL> startup
    ORACLE instance started.
    Total System Global Area 4277059584 bytes
    Fixed Size                  2166160 bytes
    Variable Size            1493176944 bytes
    Database Buffers         2768240640 bytes
    Redo Buffers               13475840 bytes
    ORA-00600: internal error code, arguments: , , ,
    SQL> exit
    DB test2 database validated:
    RMAN> validate Database;
    No issues reported.
    Could anyone please let me the what's the cause of this error
    Thanks for your time
    Regards,
    user10088255

    HI,
    CASE : I
    C:\>set ORACLE_SID=xxxx
    C:\>sqlplus sys/XXXXX@rosen as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Sat Jan 29 12:28:00 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    Total System Global Area   3423965184 bytes
    Fixed Size                      2180544 bytes
    Variable Size                2080377408 bytes
    Database Buffers           1325400064 bytes
    Redo Buffers                   16007168 bytes
    ORA-00600: internal error code, arguments: [kccsbck_first], [1], [3978145973],
    Solution:   AFTER GETTING  ORA-00600, SHUT THE DATABASE AND STARTUP IT INTO MOUNT STAGE  AND  THEN ALTER  DATABASE   TO OPEN STAGE .
    SQL> shut immediate
    ORA-01507: database not mounted
    ORACLE instance shut down.
    SQL> startup mount
    ORACLE instance started.
    Total System Global Area 3423965184 bytes
    Fixed Size                      2180544 bytes
    Variable Size                 2080377408 bytes
    Database Buffers           1325400064 bytes
    Redo Buffers                    16007168 bytes
    Database mounted.
    SQL> alter database open;
    Database altered.
    SQL> select name,open_mode from v$database;
    NAME      OPEN_MODE
    ROSEN     READ WRITE
    CASE :: II
    C:\>sqlplus sys/XXXX@royalton as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Sat Jan 29 12:37:37 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    Total System Global Area  3423965184 bytes
    Fixed Size                      2180544 bytes
    Variable Size                  1979714112 bytes
    Database Buffers            1426063360 bytes
    Redo Buffers                  16007168 bytes
    ORA-00600: internal error code, arguments: [kccsbck_first], [1], [73515151],[], [], [], [], [], [], [], [], []
    Solution :  As in above case, I have started the database in mount and then alter it to the open mode but it doesnot work out. After some analysis ,troubleshooting and googling, we have decided to flush the shared pool  component of the SGA . So, we have started the database in mount stage and then flush the shared pool and further alter it to open stage . Below are the steps performed to solve this issue .
    SQL> shut immediate
    ORA-01507: database not mounted
    ORACLE instance shut down.
    C:\>set ORACLE_SID= royalton
    C:\>sqlplus sys/xxxxxxxx@royalton  as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Sat Jan 29 12:28:00 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup mount
    ORACLE instance started.
    Total System Global Area 3423965184 bytes
    Fixed Size                     2180544 bytes
    Variable Size                 2080377408 bytes
    Database Buffers            1325400064 bytes
    Redo Buffers                  16007168 bytes
    Database mounted.
    SQL> alter system flush shared_pool;
    SQL> alter database open
    Database altered.
    SQL> select name,open_mode from v$database;
    NAME            OPEN_MODE
    ROYALTON        READ WRITE
    Conclusion : Though this is not the solution but a workaround to solve ORA-00600  which is having same argument as above, then you may follow the above steps.
    Please chek this link : One Can Succeed at Almost Anything For Which He Has Enthusiasm...: ORA-00600: internal error code, arguments: [kccsbck_f…

  • The error showing as Fiscal year change has not carried out for the coCd

    Hi all,
    I am facing a very critical situation. My client has the last closed fiscal year as 2006(from 2006 april to 2007 march).For the fiscal yr. 2007(2007april to 2008 march) they have already finalised and submitted the reports made from some parallel software.They now want to tally this report with SAP system and to adjust the SAP system entries as per this report.This work was running fine.But on 01.04.2009 none of the asset reports are running.The error it's throwing is as-
    Fiscal year change not yet made for company code PWAL
    Message no. AB059
    Diagnosis
    You have not yet carried out a fiscal year change for company code PWAL, although the current system date is in the new fiscal year.
    Procedure
    Carry out the fiscal year change for company code PWAL.
    Proceed
    The error is quite understandable.We have to close 2007 and then perform the fiscal year change.But the problem is that the adjustment for the year 2007 is not yet complete.Is it the only solution with me that I should close the yr.2007 and again open it after the fiscal yr. change? If that is done can I take care of the adjustment in the posted depreciation? Or is it possible that the system date can be made back to 31.03.2009(very stupid ask!). The real problem is that my client has mistakely created some assets in the year 2007(by AS91 after changing the take over date) those should have been shown in the next year and also some assets are creted in the year 2008 by the same strange method those should be shown in the year 2007.What I am doing now is deleting these legacy assets and creating the new assets in the correct year.And this process is not yet complete.If I close the year 2007, then the depreciation of these legacy assets will also be posted.Later how can I reverse the effect?Also without seeing the reports I can't make the adjustments.Please suggest/advice.
    Debabrata

    Hi Debabrata,
    You have to do all fiscal year closing steps for 2007. When you reopen it you can do a repeat run for 2007. (You can do the reapeat run only for the new/ changed assets.)
    Try first to test this in an actual test system (document it and do the same in production). Perhaps as you know when 2009 is open I want to close 2008 in one week.  All changes they make in the asset system (change depreciation keys, recalulating,...) can result in postings in 2007 / 2008 what they don't want and later fiscal year problems. You will found a lot off masages about this on the form.

  • I got the error ORA-12154 trying to connect my app but not with the SQLplus

    Hello! i need your help,
    I have a client (Win XP SP2) and i'm trying to connect to the database in the server (Windows 2003, Oracle 10G) using the SQL plus, this is ok, but i try to do it throught the application developed in Developer 6i and i cannot, i got the error: ORA-12154 TNS:could not resolve service name. I tried to solve it by setting the env. var TNS_ADMIN and i still have the same error.
    Could anyone help me?, please

    Hi,
    Check for following file TNSNAMES.ORA at location;
    C:\<Forms-directory>\NET80\ADMIN
    See, if your service name is added to your file. If not then add a new entry like;
    gsm.world =
    (DESCRIPTION =
    (ADDRESS = (COMMUNITY = tcp)(PROTOCOL = TCP)(Host = 10.0.1.22)(Port = 1521))
    (CONNECT_DATA = (SID = gsm))
    Where:
    gsm.world = your service through which you connect to databse.
    Host = ip address of machine where oracle server is running.
    sid = name of your database
    If you already have entry of service in TNSNAMES.ora file then paste you service here as is did , so that we can check because the error you are facing is only due to service problem. Please update........

Maybe you are looking for

  • How to display a screen in selection-screen?

    hi friends, I have a requirement. I have one PNP database SELECTION-SCREEN in my report program. And i have created one more screen using screen painter. Now i hae to display that screen which i created using screen painter under PNP SELECTION-SCREEN

  • Is there any  George Martin's "A song of ice and fire" series in canadian ibook store??

    i ve searching this 4 a long time, but it seems that there r no "a song of ice and fire" series in canadian ibook store, unfortunately only in U.S. one. when is it going to be published in canadian ones?

  • Adobe "greyscale" available through Lightroom 5.4 or CC 'Basic Panel, B&W'?

    Does "Black and White" selection In Lightroom 5.4/CC "Basic Panel" completely, fully convert an image to Adobe "Greyscale"? Do not want to create another large file by having to go into PS CC just to 'convert to 'greyscale'. Need to know if all color

  • Exe installer for 32 bit windows

    hi all, i've made an exe installer with labview 8.6 in a computer with windows 7 (64bit) When i try to install it in a computer with windows xp 32 bit, i can't do it i have this message: (attached) How can i do to make it work? Attachments: error ins

  • L2440X Driver for Windows 7 x64

    Hello all together, how do I get a driver for Windows 7 x64 ago for this monitor? Windows detects the monitor is only as PNP monitor. The monitor is connected to an XFX 5850 by DP. I had already downloaded the driver from Lenovo, but this can not be