Conversion Error - when Stored Procedure Execution Statement line is broken

Hi ,
I am getting data type conversion Error whenever any value of a multivalued parameter is brought to the next line(or breaking up of the EXEC command to multiple lines, by enter key or tab.
On executing SP_ABC with second value for @parm3UID in the next line-
THE ERROR IS -
Similarly when date value for @parm4Date is throwing when SP Execution statement is
Kindly help me resolving the issue.
Thanks in Advance!!
Mridhula
Mridhula.S

Oh sorry Patrick , here is the code-
when second value of @parm3UID is entered to the next line-
exec dbo.SP_ABC @parm1UID=N'DF617C6D-F68F-E411-9CAE-180373C4FF6B',
@parmProgram=N'Null', @parm3UID=N'AA8AC32B-2AC5-E311-80CB-005056B2487C,
661E59C1-29C5-E311-80CB-005056B2487C',
@parm4Date='2015-01-05 00:00:00'
 For the above code Error displayed is
Conversion failed when converting from a character string to uniqueidentifier.
when Date value @parm4Date is broken-
exec dbo.SP_ABC @parm1UID=N'DF617C6D-F68F-E411-9CAE-180373C4FF6B',
@parmProgram=N'Null', @parm3UID=N'AA8AC32B-2AC5-E311-80CB-005056B2487C,661E59C1-29C5-E311-80CB-005056B2487C',
@parm4Date='2015-01-05
 00:00:00'
 For the above code Error displayed is
Msg 8114, Level 16, State 1, Procedure SP_ABC, Line 0
Error converting data type varchar to datetime
When the codes come in a single line exec statement works fine.Only issue is when a carriage return or tab comes in between. Please let me know for further details.
Thanks!!
Mridhula.S

Similar Messages

  • Error when stored procedure returns cursor in pro c

    Hi
    I was trying to make work the stuff explained at
    [m-2537153]
    It executes a stored procedure from pro c that returns a cursor.
    But when i compllie at pro c I get following error. My procedure name is TEST.
    If i change the output parameter to a int value. It compiles ok.
    PLS-S-00306, wrong number or types of arguments in call to 'TEST'
    Error at line 34, column 5 in file E:\C\Test\tt.pc
    TEST(:test_cursor);
    +....1+
    PLS-S-00000, Statement ignored
    Semantic error at line 33, column 1, file E:\C\Test\tt.pc:
    BEGIN
    +1+
    PCC-S-02346, PL/SQL found semantic errors
    Can any one point out what could be the error?
    I am working from oracle 8i client. which connects to oracle 9.0.1.
    OS is win 2000 sp4

    This is my code
    int main(int argc, char** argv)
    +{+
    EXEC SQL BEGIN DECLARE SECTION;
    char user[]="scott";
    char pwd[]="tiger";
    char server[]="testdb";
    char msg_buf[51|http://forums.oracle.com/forums/]+="";+
    int intarg1;
    int intId;
    char strName[]="";
    SQL_CURSOR tcr;
    EXEC SQL END DECLARE SECTION;
    +/* Register sql_error() as the error handler. */+
    EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error\n");
    EXEC SQL CONNECT :user IDENTIFIED BY :pwd USING :server;
    Printf("Connected to %s successfully",server);
    EXEC SQL ALLOCATE :tcr;
    EXEC SQL EXECUTE
    BEGIN
    TEST(:tcr);
    END;
    END-EXEC;
    Procedure name is TEST and it like
    CREATE OR REPLACE PROCEDURE TEST (crsdata out sys_refcursor)
    as
    BEGIN
    open crsdata for select id,name from newtab;
    END;

  • Getting an error when i am execution a BI query using ABAP.

    Hi Expert,
    I am getting an error when i am execution a BI query using ABAP. Its Giving me this Error "The Info Provider properties for GHRGPDM12 are not the same as the system default" and in the error analysis it saying as bellow.
    Property Data Integrity has been set differently to the system default.
    Current setting: 0 for GHRGPDM12
    System default: u2019 7 u2018
    As I am very new to BI and have very limited knowledge, so I am not able to understand this problem. Can any one help me to resolving this issue. Previously it as working fine, I am getting this error last 2 days.
    when i am debugging , I am getting error from
    create instance of cl_rsr_request
    CREATE OBJECT r_request
    EXPORTING
    i_genuniid = p_genuniid.
    this FM. Its not able to create the object. Can any one please help me out.
    Thanks in advance.
    Regards
    Satrajit

    Hi,
    I am able to solve this problem
    Regards
    Satrajit

  • Getting an error when i am execution an BI query

    Hi Expert,
    I am getting an error when i am execution an BI query using ABAP. Its Giving me this Error  "The Info Provider properties for GHRGPDM12 are not the same as the system default" and in the error analysis it saying  as bellow.
    Property Data Integrity has been set differently to the system default.
    Current setting: 0 for GHRGPDM12
    System default: u2019 7  u2018
    As I am very new to BI and have very limited knowledge, so I am not able to understand this problem. Can any one help me to resolving this issue. Previously it as working fine, I am getting this error last 2 days.
    when i am debugging , I am getting error from
    create instance of cl_rsr_request
      CREATE OBJECT r_request
        EXPORTING
          i_genuniid = p_genuniid.
    this FM. Its not able to create the object. Can any one please help me out.
    Regards
    Satrajit

    Hi,
    I am able to solve this problem
    Regards
    Satrajit

  • Please help.  Keep getting a conversion error when trying to convert a PDF to a .docx. Advice?

    Please help.  Keep getting a conversion error when trying to convert a PDF to a .docx. Advice?

    Sara,
    Please see my answers in bold below.
    What browser are you using? Try clearing the cache, or using a different browser. N/A
    Are you converting from within Reader, or directly via the ExportPDF website. Within Reader.I disabled the OCR and this did not work either. Try converting from within Reader, and disable OCR as detailed in this document: How to disable Optical Character Recognition (OCR) when converting PDF to Word or Excel.
    Are you on a networked computer? Make sure that there aren't any firewall/proxy settings that are preventing you from uploading files to the Internet. Not having problems uploading the file--that works fine.
    Make sure the file is within the file-size limit of 100 MB. It is <40.
    I get the error message, "File failed to be converted using Adobe ExportPDF online."
    Thanks for your help in advance.

  • SSRS. Not passing fields/parameters to report when stored procedure keeps parameters inside IF statement

    So what I mean:
    I have stored procedure like this:
    CREATE PROCEDURE sp_Example
    @param1 NVARCHAR(20) = '',
    @param2 DATE = ''
    AS
    BEGIN
    IF (SELECT COUNT(*) FROM Table1 WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')) > 2
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table2
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    IF (SELECT COUNT(*) FROM Table1 WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')) < 2
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table3
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    END
    So in stored procedure are some input parameters and they are passed into IF statement.
    If I use this stored procedure as report's dataset (Microsoft Visual Studio 2013) in following:
    Add
    Dataset > Query
    Type: Stored Procedure > sp_Example It
    do NOT get any fields, but get parameters
    If I use this stored procedure in following:
    Add
    Dataset > Query
    Type: Text > EXECUTE
    sp_Example It get all required fields, but do NOT get parameters
    Of course If I add manually parameters or fields It not working.
    If I change IF statement
    in stored procedure something like:
    IF (1 < 3)
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table3
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    It normally working in report (getting all fields and parameters). So problem is that I pass parameters to IF statement.
    Have you any ideas how to pass parameters to IF statement
    and get It correctly working on report?

    Hi Stanisolvas,
    Per my understanding that you are experending some issue when using the stored procedure to create the dataset, you can't get the fields to display under the dataset, right?
    I have tested on my local environment with the same script as your and can't reproduce the issue, Please try to check and provide more details information according to below points:
    What do you mean of not get any fields, Is that mean no table header along with the value will display? If you got any error message, please provide it.
    Did you use any temp table in the stored procedure, if so, the issue can be caused by the temp table you are using, please don't use temp table in it which will cause no fields display.
    If you use the second method to execute the procedure, please check to make sure you have added the script like below to make the parameters display in the report:
    exec sp_Example @Param1=@Param1,@Param2=@Param2
    Please execute the stored procedure in the SQL Server Management Studio like below to see if the stored procedure will works fine:
    exec sp_Example @Param1='Test1',@Param2='2014-10-15'
    If this work fine in the management studio, please try to create an new report to re-add this procedure.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • How to call CLOB to BLOB conversion function within stored procedure?

    I have a tiny APEX application from which I need to be able to print. I’ve used these two resources: (Is there an inexpensive APEX report printer for invoices/checks/statements? and http://download.oracle.com/docs/cd/E14373_01/appdev.32/e13363/up_dn_files.htm#CJAHDJDA)
    I guess that in order to be able to download the RTF document stored in CLOB, I need to convert it into BLOB. I’ve found this function for this purpose on Oracle forums:
    CREATE OR REPLACE FUNCTION     c2b( c IN CLOB ) RETURN BLOB
    -- typecasts CLOB to BLOB (binary conversion)
    IS
              pos PLS_INTEGER := 1;
              buffer RAW( 32767 );
              res BLOB;
              lob_len PLS_INTEGER := DBMS_LOB.getLength( c );
    BEGIN
         DBMS_LOB.createTemporary( res, TRUE );
         DBMS_LOB.OPEN( res, DBMS_LOB.LOB_ReadWrite );
    LOOP
         buffer := UTL_RAW.cast_to_raw( DBMS_LOB.SUBSTR( c, 16000, pos ) );
         IF          UTL_RAW.LENGTH( buffer ) > 0
         THEN
                   DBMS_LOB.writeAppend( res, UTL_RAW.LENGTH( buffer ), buffer );
         END IF;
         pos := pos + 16000;
         EXIT WHEN pos > lob_len;
    END LOOP;
    RETURN res; -- res is OPEN here
    END c2b;And I am trying to use it in the modified download procedure that I also have found on Oracle forums:
    CREATE OR REPLACE PROCEDURE DOWNLOAD_WO(v_id IN NUMBER)
    AS
            v_mime          VARCHAR2(48);
            v_length     NUMBER;
            v_file_name     VARCHAR2(2000):= 'WO_Download.rtf';
            lob_loc          CLOB;
              v_blob      BLOB;
              v_company        jobs_vw.company%TYPE;
              v_project        jobs_vw.project%TYPE;
              v_description     jobs_vw.description%TYPE;
              v_date_          jobs_vw.date_%TYPE;
              v_job_no          jobs_vw.job_no%TYPE;
              v_apqwo               jobs_vw.apqwo%TYPE;
    --          v_mime           VARCHAR2(48) := 'application/msword';
    BEGIN
            SELECT     mime_type, report, DBMS_LOB.GETLENGTH(report)
              INTO     v_mime,lob_loc,v_length
              FROM     report_layouts
              WHERE     rl_id = 22332925279634283;
    -- JOB_VW record:
        SELECT     job_no
                   ,date_
                   ,description
                   ,apqwo
                   ,project
                   ,company       
         INTO     v_job_no
                   ,v_date_
                   ,v_description
                   ,v_apqwo
                   ,v_project
                   ,v_company
         FROM     jobs_vw
         WHERE     id = 214;
    -- Replace holders with actual values:
        lob_loc := REPLACE(lob_loc, '#COMPANY#', v_company);
        lob_loc := REPLACE(lob_loc, '#PROJECT#', v_project);
        lob_loc := REPLACE(lob_loc, '#DESCRIPTION#', v_description);
        lob_loc := REPLACE(lob_loc, '#DATE_#', TO_CHAR(v_date_, 'DD/MM/YYYY'));
        lob_loc := REPLACE(lob_loc, '#JOB_NO#', v_job_no);
        lob_loc := REPLACE(lob_loc, '#APQWO#', v_apqwo);
                  -- set up HTTP header
                        -- use an NVL around the mime type and
                        -- if it is a null set it to application/octect
                        -- application/octect may launch a download window from windows
                        owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
                    -- set the size so the browser knows how much to download
                    htp.p('Content-length: ' || v_length);
                    -- the filename will be used by the browser if the users does a save as
                    htp.p('Content-Disposition:  attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
                    -- close the headers           
                    owa_util.http_header_close;
                    -- download the BLOB
    --                wpg_docload.download_file( Lob_loc );
                             v_blob := c2b(lob_loc);
                             wpg_docload.download_file( v_blob );
    end DOWNLOAD_WO;
    /Unfortunately when I try to compile the download_wo stored procedure I am getting this error:
    Error at line 64: PL/SQL: Statement ignoredThe 64th line is:
    v_blob := c2b(lob_loc);How should I correctly call c2b within download_wo? Any advice is greatly appreciated.
    Thank you for your time.
    Daniel

    Hello there,
    Well, its invalid :(
    Object C2B is Invalid. I didn't know since when I run the create ... function, I only get this feedback:
    Statement processed.
    0.19 secondsI am investigating.
    Daniel

  • Error in stored procedure while using dbms_datapump for transportable

    Hi,
    I'm facing following issue:
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    ====================================================================================
    I'm trying to do transportable tablespace through stored procedure with help of DBMS_DATAPUMP, Following is the code :
    ==================================================================================
    create or replace
    procedure sp_tts_export(v_tbs_name varchar2) as
    idx NUMBER; -- Loop index
    JobHandle NUMBER; -- Data Pump job handle
    PctComplete NUMBER; -- Percentage of job complete
    JobState VARCHAR2(30); -- To keep track of job state
    LogEntry ku$_LogEntry; -- For WIP and error messages
    JobStatus ku$_JobStatus; -- The job status from get_status
    Status ku$_Status; -- The status object returned by get_status
         dts           varchar2(140):=to_char(sysdate,'YYYYMMDDHH24MISS');
         exp_dump_file varchar2(500):=v_tbs_name||'_tts_export_'||dts||'.dmp';
         exp_log_file varchar2(500):=v_tbs_name||'_tts_export_'||dts||'.log';
         exp_job_name varchar2(500):=v_tbs_name||'_tts_export_'||dts;
         dp_dir varchar2(500):='DATA_PUMP_DIR';
         log_file UTL_FILE.FILE_TYPE;
         log_filename varchar2(500):=exp_job_name||'_main'||'.log';
         err_log_file UTL_FILE.FILE_TYPE;
         v_db_name varchar2(1000);
         v_username varchar2(30);
         t_dir_name VARCHAR2(4000);
    t_file_name VARCHAR2(4000);
    t_sep_pos NUMBER;
         t_dir varchar2(30):='temp_0123456789';
         v_sqlerrm varchar2(4000);
    stmt varchar2(4000);
         FUNCTION get_file(filename VARCHAR2, dir VARCHAR2 := 'TEMP')
    RETURN VARCHAR2 IS
    contents VARCHAR2(32767);
    file BFILE := BFILENAME(dir, filename);
    BEGIN
              DBMS_LOB.FILEOPEN(file, DBMS_LOB.FILE_READONLY);
              contents := UTL_RAW.CAST_TO_VARCHAR2(
    DBMS_LOB.SUBSTR(file));
              DBMS_LOB.CLOSE(file);
              RETURN contents;
         END;
    begin
    --execute immediate ('drop tablespace test including contents and datafiles');
    --execute immediate ('create tablespace test datafile ''/home/smishr02/test.dbf'' size 10m');
    --execute immediate ('create table prestg.test_table (a number) tablespace test');
    --execute immediate ('insert into prestg.test_table values (1)');
    --commit;
    --execute immediate ('alter tablespace test read only');
    --dbms_output.put_line('11111111111111111111');
    dbms_output.put_line(log_filename||'>>>>>>>>>>>>>>>>>>>>>>>>>>>'|| dp_dir);
    log_file:=UTL_FILE.FOPEN (dp_dir, log_filename, 'w');
    UTL_FILE.PUT_LINE(log_file,'#####################################################################');
    UTL_FILE.PUT_LINE(log_file,'REPORT: GENERATED ON ' || SYSDATE);
    UTL_FILE.PUT_LINE(log_file,'#####################################################################');
    select global_name,user into v_db_name,v_username from global_name;
    UTL_FILE.PUT_LINE(log_file,'Database:'||v_db_name);
    UTL_FILE.PUT_LINE(log_file,'user running the job:'||v_username);
    UTL_FILE.PUT_LINE(log_file,'for tablespace:'||v_tbs_name);
    UTL_FILE.NEW_LINE (log_file);
    stmt:='ALTER TABLESPACE '||v_tbs_name || ' read only';
    dbms_output.put_line('11111111111111111111'||stmt);
    execute immediate (stmt);
    UTL_FILE.PUT_LINE(log_file,' '||v_tbs_name || ' altered to read only mode.');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,'#####################################################################');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Initiating the Datapump engine for TTS export..............');
    UTL_FILE.NEW_LINE (log_file);
    dbms_output.put_line('11111111111111111111');
    JobHandle :=
    DBMS_DATAPUMP.OPEN(
    operation => 'EXPORT'
    *,job_mode => 'TRANSPORTABLE'*
    *,remote_link => NULL*
    *,job_name => NULL*
    --,job_name => exp_job_name
    --        ,version => 'LATEST'
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Allocating dumpfile................');
    DBMS_DATAPUMP.ADD_FILE(
    handle => JobHandle
    ,filename => exp_dump_file
    ,directory => dp_dir
    ,filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE
    -- ,filesize => '100M'
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Allocating logfile................');
    DBMS_DATAPUMP.ADD_FILE(
    handle => JobHandle
    ,filename => exp_log_file
    ,directory => dp_dir
    ,filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Setting attributes................');
    DBMS_DATAPUMP.set_parameter(handle => JobHandle,
    name=>'TTS_FULL_CHECK',
    value=>1);
    DBMS_DATAPUMP.METADATA_FILTER(
    handle => JobHandle
    ,NAME => 'TABLESPACE_EXPR'
    ,VALUE => 'IN ('''||v_tbs_name||''')'
    -- ,object_type => 'TABLE'
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Now starting datapump job................');
    DBMS_DATAPUMP.START_JOB(JobHandle);
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Monitoring the job................');
    --------------Monitor the job
    PctComplete := 0;
    JobState := 'UNDEFINED';
    WHILE(JobState != 'COMPLETED') and (JobState != 'STOPPED')
    LOOP
    DBMS_DATAPUMP.GET_STATUS(
    handle => JobHandle
    ,mask => 15 -- DBMS_DATAPUMP.ku$_status_job_error + DBMS_DATAPUMP.ku$_status_job_status + DBMS_DATAPUMP.ku$_status_wip
    ,timeout => NULL
    ,job_state => JobState
    ,status => Status
    JobStatus := Status.job_status;
    -- Whenever the PctComplete value has changed, display it
    IF JobStatus.percent_done != PctComplete THEN
    DBMS_OUTPUT.PUT_LINE('*** Job percent done = ' || TO_CHAR(JobStatus.percent_done));
    PctComplete := JobStatus.percent_done;
    END IF;
    -- Whenever a work-in progress message or error message arises, display it
    IF (BITAND(Status.mask,DBMS_DATAPUMP.ku$_status_wip) != 0) THEN
    LogEntry := Status.wip;
    ELSE
    IF (BITAND(Status.mask,DBMS_DATAPUMP.ku$_status_job_error) != 0) THEN
    LogEntry := Status.error;
    ELSE
    LogEntry := NULL;
    END IF;
    END IF;
    IF LogEntry IS NOT NULL THEN
    idx := LogEntry.FIRST;
    WHILE idx IS NOT NULL
    LOOP
    DBMS_OUTPUT.PUT_LINE(LogEntry(idx).LogText);
    idx := LogEntry.NEXT(idx);
    END LOOP;
    END IF;
    END LOOP;
         --copy the datafiles to data dump dir     
         UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Copying datafiles to dump directory................');
    -- grant select on dba_directories to prestg;
    declare
    cnt number;
    begin
    select count(*) into cnt from dba_directories
    where directory_name=upper(t_dir);
    if cnt=1 then
    execute immediate('DROP DIRECTORY '||t_dir);
    end if;
    end;
         FOR rec in (select file_name from sys.dba_data_files where tablespace_name=v_tbs_name)
         LOOP
         t_sep_pos:=instr(rec.file_name,'/',-1);
    t_dir_name:=substr(rec.file_name,1,t_sep_pos-1);
    t_file_name:=substr(rec.file_name,t_sep_pos+1,length(rec.file_name));
    dbms_output.put_line(t_dir_name|| ' ' || t_dir);
    dbms_output.put_line(t_file_name);
         execute immediate('CREATE DIRECTORY '||t_dir||' AS '''||t_dir_name||'''');
         UTL_FILE.PUT_LINE(log_file,' Copying '||rec.file_name||'................');
         utl_file.fcopy(t_dir, t_file_name, dp_dir, t_file_name);
         UTL_FILE.PUT(log_file,'Done');
         execute immediate('DROP DIRECTORY '||t_dir);
         END LOOP;
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Altering tablespace to read write................');
         execute immediate ('ALTER TABLESPACE '||v_tbs_name || ' read write');
    UTL_FILE.PUT(log_file,' Done');
         err_log_file:=utl_file.fopen(dp_dir, exp_log_file, 'r');
         UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' content of export logfile................');
         loop
    begin
         utl_file.get_line(err_log_file,v_sqlerrm);
         if v_sqlerrm is null then
         exit;
         end if;
         UTL_FILE.PUT_LINE(log_file,v_sqlerrm);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    END;
         end loop;
              utl_file.fclose(err_log_file);
    utl_file.fclose(log_file);
    END;
    I'm getting following error when DBMS_DATAPUMP.OPEN is called in procedure:
    SQL> exec sp_tts_export('TEST');
    BEGIN sp_tts_export('TEST'); END;
    ERROR at line 1:
    ORA-31626: job does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 938
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 4566
    ORA-06512: at "PRESTG.SP_TTS_EXPORT", line 78
    ORA-06512: at line 1
    ==============================================================================================
    This procedure is part of user ABC. I'm getting the above when I'm running this under ABC schema. However I have tested the same procedure under sys schema. When I'm creating same procedure in SYS schema it is running fine. I am clueless on this. Pls help
    Thanks
    Shailesh
    Edited by: shaileshM on Jul 28, 2010 11:15 AM

    Privileges acquired via ROLE do NOT apply within named PL/SQL procedures.
    Explicit GRANT is required to resolve this issue.

  • Error executing Stored Procedure that returns a recordset in Visual Basic 6

    Hello, i tried to use the example in the link posted as a response to my question in a previous thread, and in Visual Basic 6, when i execute the Stored procedure it gives me the following error:
    This is the package created as indicated in the example FAQ you posted.
    package types
    as
    type cursorType is ref cursor;
    end;
    This is the procedure created as indicated in the example FAQ you posted.
    PROCEDURE SP_TITUVALO(T_BR IN VARCHAR2,
    P_Cursor OUT TYPES.cursorType )
    AS
    BEGIN
    OPEN P_Cursor FOR
    SELECT * FROM TASAS WHERE BR=T_BR AND TASA > 0;
    END;
    This is the code used to execute the Stored Procedure in VB6:
    Dim objConn As New ADODB.Connection
    Dim connString
    Dim cmdStoredProc As New ADODB.Command
    Dim param1 As New ADODB.Parameter
    Dim RS As ADODB.Recordset
    Set param1 = cmdStoredProc.CreateParameter("T_BR", adVarChar, adParamInput, 255, "97")
    cmdStoredProc.Parameters.Append param1
    objConn.Open strconex
    Set cmdStoredProc.ActiveConnection = objConn
    cmdStoredProc.CommandText = "SP_TITUVALO"
    cmdStoredProc.CommandType = adCmdStoredProc
    Set RS = cmdStoredProc.Execute
    This is the error returned:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'SP_TITUVALO'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    ****************************************************************

    Juan,
    Not sure about FAQ you are referring to, but it seems that you need to set PLSQLRSet property of ADODB.Command to TRUE. Because if you fail to do so - errors with refcursors are likely to happen.
    Consider:
    Set objConn = CreateObject("ADODB.Connection")
    objConn.ConnectionString = "Provider=OraOLEDB.Oracle;Persist Security Info=False;Data Source=test9ora;User ID=max;Password=blabla"
    objConn.Open
    'Dim cmdStoredProc
    Set cmdStoredProc = CreateObject("ADODB.Command")
    Dim param1
    Set param1 = cmdStoredProc.CreateParameter("T_BR", adVarChar, adParamInput, 255, "97")
    param1.Value = "X"
    cmdStoredProc.Parameters.Append param1
    'Dim RS
    Set cmdStoredProc.ActiveConnection = objConn
    'The following line was missed out
    cmdStoredProc.Properties("PLSQLRSet") = True
    cmdStoredProc.CommandText = "SP_TITUVALO"
    cmdStoredProc.CommandType = adCmdStoredProc
    Set RS = cmdStoredProc.ExecuteThis works fine, at least for me.
    Cheers.

  • Error creating stored procedure using Apex

    Hello,
    I have worked with Access, SQL Server, and Firebird before, but am new to Oracle. I am trying to create a stored procedure to return the count of multiple hash values in a table. I want to know the number of rows that contain hash values that are duplicates somewhere else in the table. So if my table has 10 rows containing hash values: a, b, a, b, c, d, e, a, b, a, my return value should be 7. Here is my create procedure statement:
    CREATE OR REPLACE PROCEDURE CommonHashValuesCount (dupThreshold in number, totalCount out number)
    IS
    BEGIN
    totalCount := 0;
    FOR h IN
    (SELECT DISTINCT xf.MD5_HASH, COUNT(xf.MD5_HASH) as "HashCount"
    FROM XFILE xf
    GROUP BY xf.MD5_HASH)
    LOOP
    IF h.HashCount > dupThreshold THEN
    totalCount := totalCount + h.HashCount;
    END IF;
    END LOOP;
    END;
    I get the following error when I try and run it:
    ERROR at line 12: PL/SQL: Statement ignored
    1. CREATE OR REPLACE PROCEDURE CommonHashValuesCount (dupThreshold in number, totalCount out number)
    2. IS
    3. BEGIN
    Can anyone tell me what is wrong with my create statement? Or if anyone knows how to accomplish what I want in a single sql statement, I'd love to hear it!
    TIA,
    Theresa

    Why not do it in a SQL statement so you can test it in the APEX SQL command window?
    SELECT Sum(HashCount)
      FROM (SELECT DISTINCT xf.MD5_HASH
                 , COUNT(xf.MD5_HASH) HashCount
              FROM XFILE xf
             GROUP BY xf.MD5_HASH
    WHERE HashCount > <testvalue>
    not tested
    and then simply put that into your stored procedure/package:
    SELECT Sum(HashCount)
      INTO totalCount
      FROM (SELECT DISTINCT xf.MD5_HASH
                 , COUNT(xf.MD5_HASH) HashCount
              FROM XFILE xf
             GROUP BY xf.MD5_HASH
    WHERE HashCount > dubThreshold
    also not tested
    C.

  • Unexpected error in stored procedure

    Howdy group...
    I have a stored procedure in Oracle;
    p_BILL_TO_ADDRESS1 IN CONT_ADDRESS.ADDRESS1%TYPE
    Default NULL, --VC(50)
    With a condition;
    IF p_BILL_TO_ADDRESS1 is NULL THEN
    Raise_Application_Error(-20100,'BILL TO Address cannot be a NULL Value');
    END IF;
    I have some PHP code that tries to insert the data;
    $addr = '1234 Main';
    $sth = oci_parse($conn, "begin D_ACCT_NEW(:p_BILL_TO_ADDRESS1, :P_Error_Return );end;");
    oci_bind_by_name($sth, ":p_BILL_TO_ADDRESS1", $addr, -1);
    oci_bind_by_name($sth, ":P_Error_Return", $errorcode, -1); oci_execute($sth);
    echo $errorcode;
    And I always get the following error;
    Warning: oci_execute() [function.oci-execute]: ORA-06502: PL/SQL:
    numeric or value error ORA-06512: at "SYSADM.D_ACCT_NEW", line 483
    ORA-20100: BILL TO Address cannot be a NULL Value ORA-06512: at line 1 in /home/foo/bar/glorp.php on line 25
    If anyone on the list understands the intricacies of Oracle, could you sooth my aching head and help me to understand what is going on here? I have RTFM and the following article from the PHP Oracle Cookbook;
    http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_sps.html
    ;and I still am clueless. Thanks a million in advance!
    null

    Here is the entire procedure. This is developed by a third party and I cannot chnage it, I just need to be able to write PHP to interact with it. Thanks for your help on this.
    create or replace Procedure D_ACCT_NEW
    -- Return Parameters
    p_Return OUT Varchar2,                -- CONTRACT_ID
    P_Error_Return OUT Varchar2,                -- Error Message if any
    -- Input Parameters
    p_USERNAME IN CONT_CUST.ENTRY_BY%TYPE Default NULL, --VC(40)
    p_ALT_ACCOUNT_NO IN CONT_CUST.ALT_ACCOUNT_NO%TYPE Default NULL, -- N/A
    p_ALT_SUB_ACCOUNT_ID IN CONT_CUST.ALT_SUB_ACCOUNT_ID%TYPE Default NULL, -- N/A)
    p_PARENT_CONTRACT_ID IN CONT_CUST.PARENT_CONTRACT_ID%TYPE Default NULL,
    -- Contact Data
    p_CUST_TYPE IN CUSTOMERS_INFO.CUST_TYPE%TYPE Default NULL, --VC(1)  I/B
    p_CONTACT_F_NAME IN CUSTOMERS_INFO.FIRST_NAME%TYPE           Default NULL, --VC(100)
    p_CONTACT_L_NAME IN CUSTOMERS_INFO.LAST_NAME%TYPE           Default NULL, --VC(100)
    p_CONTACT_MIDDLE_INITIAL IN CUSTOMERS_INFO.MIDDLE_INIT%TYPE      Default NULL, --VC(10)
    p_CONTACT_TITLE IN CUSTOMERS_INFO.NAME_TITLE%TYPE           Default NULL, --VC(10)
    P_CONTACT_SUFFIX IN CUSTOMERS_INFO.NAME_SUFFIX%TYPE      Default NULL, --VC(10)
    p_COMPANY_NAME IN CUSTOMERS_INFO.COMPANY_NAME%TYPE      Default NULL, --VC(50)
    p_HOME_PHONE_NUM IN CUSTOMERS_INFO.HOME_PHONE_NUM%TYPE Default NULL, --VC(25)
    p_BUSINESS_PHONE_NUM IN CUSTOMERS_INFO.BUSINESS_PHONE_NUM%TYPE Default NULL, --vn(25)
    p_COUNTRY_ID IN CUSTOMERS_INFO.COUNTRY_ID%TYPE Default NULL, --VN(4,0)
    p_EMAIL_ADDRESS IN CUSTOMERS_INFO.EMAIL_ADDRESS%TYPE      Default NULL, --VC(50)
    P_Contact_Name1 IN CUSTOMERS_INFO.other_field1%TYPE Default NULL,
    P_Contact_Name2 IN CUSTOMERS_INFO.other_field2%TYPE Default NULL,
    P_Contact_Name3 IN CUSTOMERS_INFO.other_field3%TYPE Default NULL,
    -- Bill To Data
    p_BILL_TO_NAME IN CONT_ADDRESS.NAME%TYPE                Default NULL, --VC(50)
    p_BILL_TO_ADDRESS1 IN CONT_ADDRESS.ADDRESS1%TYPE           Default NULL, --VC(50)
    p_BILL_TO_ADDRESS2 IN CONT_ADDRESS.ADDRESS2%TYPE           Default NULL, --VC(50)
    p_BILL_TO_CITY IN CONT_ADDRESS.CITY%TYPE                Default NULL, --VC(50)
    p_Bill_To_County IN CONT_ADDRESS.COUNTY%TYPE Default NULL, --VC(50)
    p_BILL_TO_STATE IN CONT_ADDRESS.STATE%TYPE Default NULL, --VC(25)
    p_BILL_TO_ZIP IN CONT_ADDRESS.POSTAL_CODE%TYPE Default NULL, --VC(20)
    p_BILL_TO_COUNTRY IN CONT_ADDRESS.COUNTRY%TYPE           Default NULL, --VC(50)
    p_BILL_TO_GEOCODE IN CONT_ADDRESS.GEOCODE%TYPE           Default NULL, --VC(15)
    p_BILL_TO_BUS_OR_RES_FLAG IN CONT_ADDRESS.BUS_OR_RES_FLAG%TYPE Default NULL, --VC(1)
    p_BILL_TO_INSIDE_CORP_FLAG IN CONT_ADDRESS.INSIDE_CORP_FLAG%TYPE Default NULL, --VC(1)
    p_TAX_REGION_ID IN CONT_CUST.TAX_REGION_ID%TYPE Default NULL, --VN(10,0)
    -- Credit Score Data
    p_SOC_SEC_NUM            IN CUSTOMERS_INFO.SOC_SEC_NUM%TYPE                Default NULL,  VC(20)
    p_ID_OR_DANDB_TYPE IN CUSTOMERS_INFO.ID_METHOD%TYPE           Default NULL, --VC(50)
    p_ID_REGION IN CUSTOMERS_INFO.ID_REGION%TYPE           Default NULL, --VC(25)
    p_ID_OR_DANB_NO          IN CUSTOMERS_INFO.IDENTIFICATION_NO%TYPE          Default NULL,  VC(25)
    p_TAX_ID IN CUSTOMERS_INFO.IDENTIFICATION_NO%TYPE Default NULL, --VC(25)
    p_DRIVER_LICENSE_NO IN CUSTOMERS_INFO.DRIVER_LICENSE_NO%TYPE Default NULL, --VC(25)
    p_PHOTO_ID_VALUE IN CUSTOMERS_INFO.PHOTO_ID_VALUE%TYPE Default NULL, --VC(25)
    p_PHOTO_ID_STATE IN CUSTOMERS_INFO.PHOTO_ID_STATE%TYPE Default NULL, --VC(25)
    pc_BIRTH_DATE IN Varchar2      Default NULL,
    p_ORIG_INTERNAL_SCORE IN CUSTOMERS_INFO.CREDIT_SCORE%TYPE      Default NULL, --VC(10)
    p_INTERNAL_SCORE IN CUSTOMERS_INFO.INTERNAL_CREDIT_SCORE%TYPE     Default NULL, --VC(10)
    p_CRED_SCORE_ADDRESS1 IN CUSTOMERS_INFO.ADDRESS1%TYPE          Default NULL, --VC(100)
    p_CRED_SCORE_ADDRESS2 IN CUSTOMERS_INFO.ADDRESS2%TYPE           Default NULL, --VC(100)
    p_CRED_SCORE_CITY IN CUSTOMERS_INFO.ADDRESS3%TYPE           Default NULL, --VC(100)
    p_CRED_SCORE_COUNTY IN CUSTOMERS_INFO.ADDRESS4%TYPE Default NULL, --VC(100)
    p_CRED_SCORE_STATE IN CUSTOMERS_INFO.ADDRESS5%TYPE           Default NULL, --VC(100)
    p_CRED_SCORE_ZIP IN CUSTOMERS_INFO.ADDRESS6%TYPE           Default NULL, --VC(100)
    p_CRED_SCORE_COUNTRY       IN CUSTOMERS_INFO.ADDRESS6%TYPE                      Default NULL,  VC(100)
    p_IntScore_Override_Date   IN CUSTOMERS_INFO.OTHER_FIELD19%TYPE       Default NULL,  N/A
    pc_CURR_ADDRESS_DATE IN Varchar2 Default NULL,
    p_PREV_ADDRESS1 IN CUSTOMERS_INFO.PREV_ADDRESS1%TYPE      Default NULL, --VC(50)
    p_PREV_ADDRESS2 IN CUSTOMERS_INFO.PREV_ADDRESS2%TYPE      Default NULL, --VC(50)
    p_PREV_CITY IN CUSTOMERS_INFO.PREV_CITY%TYPE           Default NULL, --VC(50)
    p_PREV_COUNTY IN CUSTOMERS_INFO.PREV_COUNTY%TYPE Default NULL, --VC(50)
    p_PREV_STATE IN CUSTOMERS_INFO.PREV_STATE%TYPE           Default NULL, --VC(25)
    p_PREV_ZIP IN CUSTOMERS_INFO.PREV_POSTAL_CODE%TYPE Default NULL, --VC(20)
    p_PREV_COUNTRY IN CUSTOMERS_INFO.PREV_COUNTRY%TYPE      Default NULL, --VC(25)
    -- Billing Settings
    p_BillCycle IN CONT_CUST.BILLCYCLE%TYPE Default 0,
    p_BILL_BY_EMAIL IN CUSTOMERS_INFO.BILL_BY_EMAIL%TYPE Default 'N', --VC(1)
    p_DETAIL_BILLING IN CONT_CUST.DETAIL_BILLING%TYPE      Default 'Y', --VC(1)
    p_BILL_LANGUAGE_ID IN CONT_CUST.BILL_LANGUAGE_ID%TYPE Default NULL, --VN(10,0)
    p_BILL_LAYOUT_ID IN CONT_CUST.BILL_LAYOUT_ID%TYPE      Default NULL, --VN(10,0)
    p_BILL_CURRENCY_ID IN CONT_CUST.BILL_CURRENCY_ID%TYPE Default NULL, --VN(10,0)
    p_FIXED_CURRENCY IN CONT_CUST.FIXED_CURRENCY%TYPE      Default NULL, --VC(1)
    p_APPLY_LATE_FEES IN CONT_CUST.APPLY_LATE_FEES%TYPE      Default NULL, --VC(1)
    p_USAGE_THRESHOLD IN CONT_CUST.USAGE_THRESHOLD%TYPE Default NULL, --VN(15,2)
    -- Payment Data
    p_AUTO_PAYMENT_FLAG IN CONT_PAYMENTS_INFO.AUTO_PAYMENT_FLAG%TYPE Default NULL, --VC(1)
    p_PAYMENT_METHOD IN CONT_PAYMENTS_INFO.PAYMENT_METHOD%TYPE      Default NULL, --VC(10)
    p_DEF_PAY_BANK_NAME IN CONT_PAYMENTS_INFO.BANK_NAME%TYPE      Default NULL, --VC(100)
    p_DEF_PAY_OWNER_NAME IN CONT_PAYMENTS_INFO.OWNER_NAME%TYPE      Default NULL, --VC(100)
    p_DEF_PAY_CARD_ADDRESS IN CONT_PAYMENTS_INFO.OWNER_ADDRESS%TYPE      Default NULL, --VC(100)
    P_DEF_PAY_ADDRESS2 IN CONT_PAYMENTS_INFO.OWNER_ADDRESS%TYPE Default NULL,
    P_DEF_PAY_CITY IN CONT_PAYMENTS_INFO.OWNER_ADDRESS%TYPE Default NULL,
    P_DEF_PAY_COUNTY IN CONT_PAYMENTS_INFO.OWNER_ADDRESS%TYPE Default NULL,
    P_DEF_PAY_STATE IN CONT_PAYMENTS_INFO.OWNER_ADDRESS%TYPE Default NULL,
    p_DEF_PAY_CARD_NUMBER IN CONT_PAYMENTS_INFO.BANK_CC_NUMBER%TYPE      Default NULL, --VC(50)
    p_DEF_PAY_CARD_TYPE IN CONT_PAYMENTS_INFO.CC_CARD_TYPE_ID%TYPE Default NULL, --VC(10)
    pc_DEF_PAY_CARD_EXPIRES IN Varchar2 Default NULL,
    p_DEF_PAY_AMEX_CID IN CONT_PAYMENTS_INFO.CC_AMEX_CID%TYPE      Default NULL, --VC(50)
    p_DEF_PAY_ZIP IN CONT_PAYMENTS_INFO.CARDHOLDER_POSTAL_CODE%TYPE Default NULL, --VC(10)
    P_DEF_PAY_ROUTING_NO IN CONT_PAYMENTS_INFO.ABA%TYPE Default NULL,
    P_DEF_CHK_ACCOUNT_TYPE IN CONT_PAYMENTS_INFO.ACCOUNT_TYPE%TYPE Default NULL,
    p_DEF_PAY_CARD_CCV2 IN CONT_PAYMENTS_INFO.CC_CCV2_NUMBER%TYPE Default NULL,
    -- Other
    p_SALES_REP_FLAG IN CUSTOMERS_INFO.SALES_REP_FLAG%TYPE Default NULL, --VC(1)
    pc_ACT_DATE IN Varchar2 Default NULL,
    pc_ENTRY_DATE IN Varchar2 Default NULL,
    p_STATUS IN CONT_CUST.ACCOUNT_STATUS%TYPE Default NULL,
    -- Credit Control
    p_Credit_Category IN CONT_CCTRL_INFO.Credit_Category%TYPE Default NULL,
    p_Credit_Risk IN CONT_CCTRL_INFO.Credit_Risk%TYPE Default NULL,
    p_Credit_Status IN CONT_CCTRL_INFO.Credit_Status%TYPE Default NULL,
    pc_PTP_Date IN Varchar2 Default NULL,
    p_RECEIVE_SMS_FLAG IN CONT_CCTRL_INFO.RECEIVE_SMS_FLAG%TYPE Default NULL,
    p_AUTO_RECONNECT_FLAG IN CONT_CCTRL_INFO.AUTO_RECONNECT_FLAG%TYPE Default NULL,
    p_CCTRL_BYPASS_FLAG IN CONT_CCTRL_INFO.CCTRL_BYPASS_FLAG%TYPE Default NULL,
    p_Excel_LD_Flag IN CUSTOMERS_INFO.other_field5%TYPE Default NULL,
    P_VIP_Type IN CUSTOMERS_INFO.other_field6%TYPE Default NULL,
    P_CPNI_FLAG IN CUSTOMERS_INFO.OTHER_FIELD9%TYPE Default NULL,
    p_Promo_Id IN Varchar2 Default NULL,
    p_Carrier_Id IN CONT_CUST.CARRIER_ID%TYPE Default NULL,
    p_Category_ID IN CONT_CUST.Category_ID%TYPE Default NULL,
    p_MTA_ID IN CONT_CUST.MTA_ID%TYPE Default 1,
    p_REQUIRED_DEPOSIT_AMT IN CUSTOMERS_INFO.OTHER_FIELD11%TYPE Default NULL,
    p_PREPAY_FLAG IN CONT_CUST.PREPAY_FLAG%TYPE Default NULL,
    P_ALT_ACCOUNT_NO2 IN CUSTOMERS_INFO.OTHER_FIELD12%TYPE Default NULL,
    P_EWAVE_CREDIT_SCORE IN CUSTOMERS_INFO.OTHER_FIELD13%TYPE Default NULL,
    P_EWAVE_APPLICATION_NO IN CUSTOMERS_INFO.OTHER_FIELD14%TYPE Default NULL,
    P_ALT_OWNER_NAME IN CUSTOMERS_INFO.ALT_OWNER_NAME%TYPE Default NULL,
    P_ALT_OWNER_PASSWORD IN CUSTOMERS_INFO.ALT_OWNER_PASSWORD%TYPE Default NULL,
    P_SALES_REP_ID IN CUSTOMERS_INFO.SALES_REP_ID%TYPE Default NULL,
    P_SALES_REP_EMAIL IN CUSTOMERS_INFO.SALES_REP_EMAIL%TYPE Default NULL
    IS
    ---------0---------0---------0---------0---------0---------0---------0--------80
    -- PURPOSE : Creates a NEW Account
    -- PARAMETERS : See above.
    -- NOTES :
    -- RETURN : 1) If successfull ................: Contract_Id
    -- 2) If a logical error then .......: ' ' (1 space)
    -- ERROR : If an exception error..........: 'p_error_return = sqlerrm.........'
    -- MODIFICATION HISTORY :
    -- Person Date Comments
    -- Mary Phan Jun 15, 2004 Init version. This procedure will execute procedure D_ACCT_NEW
    -- Mary Phan Jul 07, 2004 Add SALES_REP_ID and SALES_REP_EMAIL
    -- Subas Sep 07, 2005 Modified for ECAM
    -- Subas Sep 19, 2005 Added code to insert a blank record in CONT_MISC_DATA
    cc_PROC_NAME Varchar2(30):='D_ACCT_NEW';
    vc_SECTION Varchar2(10):='000';
    vn_Count Number;
    R_CCTRL_INFO_REC CONT_CCTRL_INFO%ROWTYPE;
    R_CI_REC CUSTOMERS_INFO%ROWTYPE;
    R_CC_REC CONT_CUST%ROWTYPE;
    R_CA_REC CONT_ADDRESS%ROWTYPE;
    R_CPI_REC CONT_PAYMENTS_INFO%ROWTYPE;
    vn_Customer_Id CONT_CUST.CUSTOMER_ID%TYPE;
    vn_Contract_Id CONT_CUST.CONTRACT_ID%TYPE;
    vc_bill_to_name CONT_ADDRESS.NAME%TYPE;
    vd_act_date CONT_CUST.ACT_DATE%TYPE;
    vn_BillCycle CONT_CUST.BILLCYCLE%TYPE;
    vc_Credit_Risk CONT_CCTRL_INFO.CREDIT_RISK%TYPE;
    vn_PARENT_CONTRACT_ID CONT_CUST.PARENT_CONTRACT_ID%TYPE;
    BEGIN
    vc_SECTION:='010';
    -- CHECK FOR CUSTOMER TYPE :
    IF UPPER(p_cust_type) NOT IN ('I','B') THEN
    Raise_Application_Error(-20100,'Customer type may be either "I" or "B"');
    END IF;
    -- CHECK FOR CUSTOMER NAME :
    IF UPPER(p_cust_type)='I' THEN
    IF ltrim(rtrim(p_contact_f_name)) is NULL THEN
    Raise_Application_Error(-20100,'Customer Name can not be a NULL Value');
    END IF;
    ELSIF UPPER(p_cust_type)='B' THEN
    IF ltrim(rtrim(p_company_name)) is NULL THEN
    Raise_Application_Error(-20100,'Company Name can not be a NULL Value');
    END IF;
    END IF;
    -- CHECK FOR BILL BY EMAIL :
    IF UPPER(p_bill_by_email)='Y' THEN
    IF p_EMAIL_ADDRESS is NULL THEN
    Raise_Application_Error(-20100,'Email Address cannot be a NULL Value');
    END IF;
    END IF;
    -- ASSIGN VALUES TO BILL_TO_NAME :
    vc_Bill_To_Name := ltrim(rtrim(p_BILL_TO_NAME));
    IF vc_Bill_To_Name IS NULL THEN
    IF UPPER(p_cust_type)='I' THEN
    vc_bill_to_name:=p_CONTACT_F_NAME||' '||
    p_CONTACT_MIDDLE_INITIAL||' '||
    p_CONTACT_L_NAME;
    ELSIF UPPER(p_cust_type)='B' THEN
    vc_bill_to_name:=p_COMPANY_NAME;
    END IF;
    END IF;
    -- Check for Minimum Address Requirement:
    IF p_BILL_TO_ADDRESS1 is NULL THEN
    Raise_Application_Error(-20100,'BILL TO Address cannot be a NULL Value');
    END IF;
    -- Determine Default values:
    IF pc_ACT_DATE IS NULL THEN
    vd_act_date:=sysdate;
    ELSE
    vd_act_date:=trunc(to_date(pc_ACT_DATE, 'yyyymmddhh24miss'));
    END IF;
    -- Assign BILLCYCLE:
    vn_BillCycle := p_BillCycle;
    IF vn_BillCycle = 0 THEN
    vn_BillCycle := C_UTIL_GET_DEF_BILLCYCLE (p_Carrier_Id);
    END IF;
    IF NVL(vn_Billcycle,0) = 0 then
    Raise_Application_Error(-20100,'Can not find a valid BILLCYCLE ');
    END IF;
    -- Get Customer_Id and Contract_ID from SEQUENCES :
    select contract_id_sequence.nextval into vn_Contract_Id from dual;
    select customer_id_sequence.nextval into vn_Customer_Id from dual;
    --INSERT RECORDS TO CUSTOMERS_INFO :
    vc_SECTION:='020';
    R_CI_REC.CUSTOMER_ID := vn_Customer_Id;
    R_CI_REC.FIRST_NAME := p_CONTACT_F_NAME;
    R_CI_REC.LAST_NAME := p_CONTACT_L_NAME;
    R_CI_REC.MIDDLE_INIT := p_CONTACT_MIDDLE_INITIAL;
    R_CI_REC.ADDRESS1 := p_CRED_SCORE_ADDRESS1;
    R_CI_REC.ADDRESS2 := p_CRED_SCORE_ADDRESS2;
    R_CI_REC.ADDRESS3 := p_CRED_SCORE_CITY;
    R_CI_REC.ADDRESS4 := p_CRED_SCORE_COUNTY;
    R_CI_REC.ADDRESS5 := p_CRED_SCORE_STATE;
    R_CI_REC.ADDRESS6 := p_CRED_SCORE_ZIP;
    --R_CI_REC.ADDRESS6                   := p_CRED_SCORE_Country;
    R_CI_REC.OTHER_FIELD1 := P_Contact_Name1;
    R_CI_REC.OTHER_FIELD2 := P_Contact_Name2;
    R_CI_REC.OTHER_FIELD3 := P_Contact_Name3;
    R_CI_REC.OTHER_FIELD4 := 0;
    R_CI_REC.OTHER_FIELD5 := p_Excel_LD_Flag;
    R_CI_REC.OTHER_FIELD6 := P_VIP_Type;
    R_CI_REC.OTHER_FIELD7 := NULL;
    R_CI_REC.OTHER_FIELD8 := NULL;
    R_CI_REC.OTHER_FIELD9 := P_CPNI_FLAG;
    R_CI_REC.OTHER_FIELD10 := P_PROMO_ID;
    R_CI_REC.OTHER_FIELD11 := P_REQUIRED_DEPOSIT_AMT;
    R_CI_REC.OTHER_FIELD12 := P_ALT_ACCOUNT_NO2;
    R_CI_REC.OTHER_FIELD13 := P_EWAVE_CREDIT_SCORE;
    R_CI_REC.OTHER_FIELD14 := P_EWAVE_APPLICATION_NO;
    R_CI_REC.OTHER_FIELD15 := NULL;
    R_CI_REC.OTHER_FIELD16 := NULL;
    R_CI_REC.OTHER_FIELD17 := NULL;
    R_CI_REC.OTHER_FIELD18 := NULL;
    R_CI_REC.OTHER_FIELD19 := NULL;
    R_CI_REC.OTHER_FIELD20 := NULL;
    R_CI_REC.EMAIL_ADDRESS := p_EMAIL_ADDRESS;
    R_CI_REC.BILL_BY_EMAIL := NVL(p_BILL_BY_EMAIL,B_UTIL_DEFSTRVAL('ACCOUNT','BILL_BY_EMAIL'));
    R_CI_REC.CUST_TYPE := p_CUST_TYPE;
    R_CI_REC.COMPANY_NAME := p_COMPANY_NAME;
    R_CI_REC.IDENTIFICATION_NO := p_TAX_ID;
    R_CI_REC.DRIVER_LICENSE_NO := p_DRIVER_LICENSE_NO;
    R_CI_REC.PHOTO_ID_VALUE := p_PHOTO_ID_VALUE;
    R_CI_REC.PHOTO_ID_STATE := p_PHOTO_ID_STATE;
    R_CI_REC.COUNTRY_ID := p_COUNTRY_ID;
    ---R_CI_REC.SOC_SEC_NUM := p_SOC_SEC_NUM;
    R_CI_REC.ID_METHOD := p_ID_OR_DANDB_TYPE;
    R_CI_REC.ID_VALUE := NULL;
    R_CI_REC.ID_REGION := p_ID_REGION;
    R_CI_REC.BIRTH_DATE := to_date(pc_Birth_Date, 'yyyymmddHH24MISS');
    R_CI_REC.HOME_PHONE_NUM := p_HOME_PHONE_NUM;
    R_CI_REC.BUSINESS_PHONE_NUM := p_BUSINESS_PHONE_NUM;
    R_CI_REC.CURR_ADDRESS_DATE := to_date(pc_Curr_Address_Date,'yyyymmddHH24MISS');
    R_CI_REC.PREV_ADDRESS1 := p_PREV_ADDRESS1;
    R_CI_REC.PREV_ADDRESS2 := p_PREV_ADDRESS2;
    R_CI_REC.PREV_CITY := p_PREV_CITY;
    R_CI_REC.PREV_COUNTY := p_PREV_COUNTY;
    R_CI_REC.PREV_STATE := p_PREV_STATE;
    R_CI_REC.PREV_POSTAL_CODE := p_PREV_ZIP;
    R_CI_REC.PREV_COUNTRY := p_PREV_COUNTRY;
    R_CI_REC.CREDIT_SCORE := p_ORIG_INTERNAL_SCORE;
    R_CI_REC.INTERNAL_CREDIT_SCORE := UPPER(p_INTERNAL_SCORE);
    R_CI_REC.INTERNAL_CREDIT_SCORE_DATE := SYSDATE;
    R_CI_REC.SALES_REP_FLAG := p_SALES_REP_FLAG;
    R_CI_REC.NAME_TITLE := p_CONTACT_TITLE;
    R_CI_REC.NAME_SUFFIX := P_CONTACT_SUFFIX;
    R_CI_REC.CREATION_DATE := SYSDATE;
    R_CI_REC.ALT_OWNER_NAME := P_ALT_OWNER_NAME;
    R_CI_REC.ALT_OWNER_PASSWORD := P_ALT_OWNER_PASSWORD;
    R_CI_REC.SALES_REP_ID := P_SALES_REP_ID;
    R_CI_REC.SALES_REP_EMAIL := P_SALES_REP_EMAIL;
    R_CI_REC.LAST_MODIFIED_DATE := SYSDATE;
    R_CI_REC.LAST_MODIFIED_BY := P_USERNAME;
    D_INS_UPD_CUSTINFO(p_Return,p_Error_Return,p_UserName,'INS',R_CI_REC);
    --INSERT RECORDS INTO CONT_CUST :
    vc_SECTION:='030';
    SELECT DECODE(P_PARENT_CONTRACT_ID,NULL,VN_CONTRACT_ID,P_PARENT_CONTRACT_ID)
    INTO VN_PARENT_CONTRACT_ID
    FROM DUAL;
    R_CC_REC.CONTRACT_ID := vn_Contract_Id;
    R_CC_REC.ACCOUNT_NO := vn_Contract_Id;
    R_CC_REC.CUSTOMER_ID := vn_customer_id;
    R_CC_REC.RP_ID := 0;
    R_CC_REC.MTA_ID := p_MTA_ID;
    R_CC_REC.TAX_REGION_ID := p_TAX_REGION_ID;
    R_CC_REC.ACT_DATE := trunc(vd_act_date);
    R_CC_REC.BILLCYCLE := vn_Billcycle;
    R_CC_REC.LAST_BILL_DATE := trunc(vd_act_date-1);
    R_CC_REC.DEACT_DATE := NULL;
    R_CC_REC.ENTRY_DATE := NVL(to_date(pc_ENTRY_DATE,'yyyymmddhh24miss'),SYSDATE);
    R_CC_REC.ENTRY_BY := p_UserName;
    R_CC_REC.OPEN_BALANCE := 0;
    R_CC_REC.PREPAY_FLAG := P_PREPAY_FLAG;
    R_CC_REC.USAGE_THRESHOLD := NVL(p_USAGE_THRESHOLD,
    B_UTIL_GET_CREDIT_LIMIT(P_Internal_Credit_Score=>UPPER(p_INTERNAL_SCORE),
    p_Contract_Type=>'ACCOUNT'));
    R_CC_REC.PMM_CUR_BALANCE := NULL;
    R_CC_REC.SUB_ACCOUNT_ID := 0;
    R_CC_REC.CATEGORY_ID := p_Category_ID;
    R_CC_REC.DEACT_REASON_ID := NULL;
    R_CC_REC.DETAIL_BILLING := NVL(P_DETAIL_BILLING,B_UTIL_DEFSTRVAL('ACCOUNT','DETAIL_BILLING'));
    R_CC_REC.CARRIER_ID := NVL(p_carrier_id,1);
    R_CC_REC.BILL_LANGUAGE_ID := NVL(p_BILL_LANGUAGE_ID,B_UTIL_DEFSTRVAL('ACCOUNT','BILL_LANGUAGE_ID'));
    R_CC_REC.BILL_LAYOUT_ID := NVL(p_BILL_LAYOUT_ID,B_UTIL_DEFSTRVAL('ACCOUNT','BILL_LAYOUT_ID'));
    R_CC_REC.BILL_CURRENCY_ID := NVL(p_BILL_CURRENCY_ID,B_UTIL_DEFSTRVAL('ACCOUNT','BILL_CURRENCY_ID'));
    R_CC_REC.FIXED_CURRENCY := NVL(p_FIXED_CURRENCY,B_UTIL_DEFSTRVAL('ACCOUNT','FIXED_CURRENCY'));
    R_CC_REC.APPLY_LATE_FEES := NVL(p_APPLY_LATE_FEES,B_UTIL_DEFSTRVAL('ACCOUNT','APPLY_LATE_FEES'));
    R_CC_REC.PARENT_CONTRACT_ID := VN_PARENT_CONTRACT_ID;
    R_CC_REC.LEVEL_NO := 0;
    R_CC_REC.AP_FLAG := 'Y';
    R_CC_REC.RESTRICTION_CLASS_ID := NULL;
    R_CC_REC.OMM_UPDATE_FLAG := 'N';
    R_CC_REC.INACTIVE_FLAG := 'N';
    R_CC_REC.SWITCH_PROFILE := NULL;
    R_CC_REC.ALT_ACCOUNT_NO := p_ALT_ACCOUNT_NO;
    R_CC_REC.ALT_SUB_ACCOUNT_ID := p_ALT_SUB_ACCOUNT_ID;
    R_CC_REC.DEPOSITED_AMT := NULL;
    R_CC_REC.READY_TO_ACT := NULL;
    R_CC_REC.ACCOUNT_STATUS := NVL(p_STATUS,'SHELL');
    R_CC_REC.EARLY_TERMINATION_FEE := NULL;
    R_CC_REC.EARLY_TERMINATION_DATE := NULL;
    R_CC_REC.SALES_REP_ID := NULL;
    R_CC_REC.MANUAL_OMM_ACTIVATE := NULL;
    R_CC_REC.PERMANENT_USAGE_THRESHOLD := R_CC_REC.USAGE_THRESHOLD;
    D_INS_UPD_CONTCUST(p_Return,p_Error_Return,p_UserName,'INS',R_CC_REC);
    --INSERT RECORDS INTO CONT_PAYMENT_INFO :
    vc_SECTION:='040';
    R_CPI_REC.CONTRACT_ID := vn_Contract_Id;
    R_CPI_REC.AUTO_PAYMENT_FLAG := NVL(p_AUTO_PAYMENT_FLAG,B_UTIL_DEFSTRVAL('ACCOUNT','AUTO_PAYMENT_FLAG'));
    R_CPI_REC.PAYMENT_METHOD := NVL(p_PAYMENT_METHOD,'CASH');
    R_CPI_REC.BANK_NAME := p_DEF_PAY_BANK_NAME;
    R_CPI_REC.OWNER_NAME := p_DEF_PAY_OWNER_NAME;
    R_CPI_REC.OWNER_ADDRESS := p_DEF_PAY_CARD_ADDRESS;
    R_CPI_REC.OWNER_ADDRESS2 := p_DEF_PAY_ADDRESS2;
    R_CPI_REC.OWNER_CITY := p_DEF_PAY_CITY;
    R_CPI_REC.OWNER_COUNTY := p_DEF_PAY_COUNTY;
    R_CPI_REC.OWNER_STATE := p_DEF_PAY_STATE;
    R_CPI_REC.BANK_CC_NUMBER := p_DEF_PAY_CARD_NUMBER;
    R_CPI_REC.CC_CARD_TYPE_ID := p_DEF_PAY_CARD_TYPE;
    R_CPI_REC.CC_EXPIRATION_DATE := to_date(pc_DEF_PAY_CARD_EXPIRES,'YYYYMMDDHH24MISS');
    R_CPI_REC.CC_AMEX_CID := p_DEF_PAY_AMEX_CID;
    R_CPI_REC.CC_AUTH_NUMBER := NULL;
    R_CPI_REC.CC_AUTH_REQUEST_AMOUNT := NULL;
    R_CPI_REC.CC_AUTH_AMOUNT := NULL;
    R_CPI_REC.CC_AUTH_DATE := NULL;
    R_CPI_REC.CARDHOLDER_POSTAL_CODE := p_DEF_PAY_ZIP;
    R_CPI_REC.ABA := P_DEF_PAY_ROUTING_NO;
    R_CPI_REC.ACCOUNT_TYPE := P_DEF_CHK_ACCOUNT_TYPE;
    R_CPI_REC.CC_CCV2_NUMBER := p_DEF_PAY_CARD_CCV2;
    R_CPI_REC.LAST_MODIFIED_DATE := SYSDATE;
    R_CPI_REC.LAST_MODIFIED_BY := P_USERNAME;
    D_INS_UPD_CONTPAYMENTSINFO(p_Return,p_Error_Return,p_UserName,'INS',R_CPI_REC);
    --INSERT RECORDS INTO CONT_ADDRESS
    vc_SECTION:='050';
    R_CA_REC.CONTRACT_ID := vn_Contract_id;
    R_CA_REC.ADDRESS_TYPE := 'B';
    R_CA_REC.NAME := vc_bill_to_name;
    R_CA_REC.ADDRESS1 := p_BILL_TO_ADDRESS1;
    R_CA_REC.ADDRESS2 := p_BILL_TO_ADDRESS2;
    R_CA_REC.CITY := p_BILL_TO_CITY;
    R_CA_REC.COUNTY := P_BILL_TO_COUNTY;
    R_CA_REC.STATE := p_BILL_TO_STATE;
    R_CA_REC.POSTAL_CODE := p_BILL_TO_ZIP;
    R_CA_REC.COUNTRY := P_BILL_TO_COUNTRY;
    R_CA_REC.GEOCODE := p_BILL_TO_GEOCODE;
    R_CA_REC.BUS_OR_RES_FLAG := p_BILL_TO_BUS_OR_RES_FLAG;
    R_CA_REC.INSIDE_CORP_FLAG := p_BILL_TO_INSIDE_CORP_FLAG;
    D_INS_UPD_CONTADDRESS(p_Return,p_Error_Return,p_UserName,'INS',R_CA_REC);
    -- INSERT RECORD INTO CONT_CCTRL_INFO :
    vc_SECTION:='060';
    IF p_Credit_Risk is not NULL then
    vc_Credit_Risk := p_Credit_Risk ;
    ELSE
    IF R_CI_REC.INTERNAL_CREDIT_SCORE IS NULL THEN
    vc_Credit_Risk := 'High';
    ELSIF R_CI_REC.INTERNAL_CREDIT_SCORE IN ('A','B') THEN
    vc_Credit_Risk := 'Low';
    ELSIF R_CI_REC.INTERNAL_CREDIT_SCORE = 'C' THEN
    vc_Credit_Risk := 'Medium';
    ELSE
    vc_Credit_Risk := 'High';
    END IF;
    END IF;
    R_CCTRL_INFO_REC.CONTRACT_ID := vn_CONTRACT_ID;
    R_CCTRL_INFO_REC.ENTRY_BY := p_UserName;
    R_CCTRL_INFO_REC.CREDIT_RISK := vc_Credit_Risk;
    R_CCTRL_INFO_REC.CREDIT_CATEGORY := NVL(p_Credit_CATEGORY,B_UTIL_DEFSTRVAL('ACCOUNT','CREDIT_CATEGORY'));
    R_CCTRL_INFO_REC.CREDIT_STATUS := NVL(p_Credit_STATUS,B_UTIL_DEFSTRVAL('ACCOUNT','CREDIT_STATUS'));
    R_CCTRL_INFO_REC.PTP_DATE := to_date(pc_PTP_Date,'yyyymmddhh24miss');
    R_CCTRL_INFO_REC.RECEIVE_SMS_FLAG := 'N';
    R_CCTRL_INFO_REC.AUTO_RECONNECT_FLAG := NVL(p_AUTO_RECONNECT_FLAG,'Y');
    R_CCTRL_INFO_REC.CCTRL_BYPASS_FLAG := NVL(p_CCTRL_BYPASS_FLAG,'N');
    R_CCTRL_INFO_REC.LAST_MODIFIED_BY := p_UserName;
    R_CCTRL_INFO_REC.LAST_MODIFIED_DATE := SYSDATE;
    D_INS_UPD_CONTCCTRLINFO(P_Return,P_Error_Return,p_UserName,'INS',R_CCTRL_INFO_REC);
    -- INSERT RECORD INTO CONT_MISC_DATA :
    vc_SECTION:='070';
    INSERT INTO CONT_MISC_DATA
    (CONTRACT_ID)
    VALUES
    (vn_Contract_Id);
    p_Return := vn_Contract_Id;
    EXCEPTION
    WHEN others THEN
    p_Return:='';
    p_Error_Return :=cc_PROC_NAME||' '|| vc_SECTION||':'|| SUBSTR(sqlerrm,1,300);
    END; -- D_ACCT_NEW

  • Security problem? (ORA-00942 error when creating procedure)

    First, in SQL*Plus connect as system user:
    SQL&gt;connect system/oracle
    Then, create table proctest for user scott and insert records:
    SQL&gt;create table scott.proctest ( name varchar2(10)) ;
    SQL&gt;insert into scott.proctest values ( 'bigboy' ) ;
    SQL&gt;select * from scott.proctest ;
    NAME
    bigboy
    Then, create procedure testproc for user system using table scott.proctest:
    SQL&gt;CREATE OR REPLACE PROCEDURE testproc AS
    2 v_name VARCHAR2(10) ;
    3 BEGIN
    4 SELECT Name INTO v_name FROM scott.proctest WHERE rownum &lt; 2 ;
    5 DBMS_OUTPUT.PUT_LINE( 'Name: ' || v_name ) ;
    6 END ;
    7 /
    Then, errs report:
    SQL&gt;show err;
    LINE/COL ERROR
    4/2 PL/SQL: SQL
    4/2 PL/SQL: SQL Statement ignored
    4/37 PL/SQL: ORA-00942: Table or view does not exist
    Then, explicitly grant select privilege on proctest to system:
    SQL&gt;grant select on scott.proctest to system ;
    And at this time compile the above precedure again, there's no errors.
    I have got some instruction that if a procedure wants to use some table,
    the owner of this procedure has to have corresponding privileges to use this table and
    these privileges have to be granted directly to the user. It doesn't work if
    the privileges are granted i.e. through roles.
    And in the example above the user has select on scott.proctest privilege but
    this privilege is granted through DBA role. So it doesn't work if
    I do not explicitly grant select privilege to system.
    My question is:
    Why does Oracle define this rule? Is it a kind of security consideration?

    Since stored procedures rely on privileges that are granted directly to the user, Oracle only needs to re-validate stored procedures when direct grants to the schema owner change. In general, the rate at which the privileges assigned to roles are changed is much higher than the rate at which privileges assigned to a particular user are changed, so this cuts down on on the cost of revalidating procedures.
    More importantly, Oracle roles can be assigned to users, but a user can also have non-default roles and password-protected roles. If Oracle allowed privileges through roles to affect the privileges of a stored procedure, handling these sorts of cases would be quite difficult and would result in far more confusion than in today's implementation.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Error with stored procedure block datasource

    Hi all,
    I tried to base a datablock on a stored procedure in order to get better runtime performance. I work with Forms Builder 6i with patch 17 , and our database is oracle 8.1.7.1.4
    But when compiling I got errors.
    Here are what I did :
    create or replace type TSourceObject as object(name varchar2(30), propname varchar2(200));
    create or replace type TSourceTable is table of TSourceObject;
    create or replace procedure p_query_ntwk_chnl_mirror(p_tab IN OUT NOCOPY TSourceTable, p_action varchar2, p_lien number)
    is
    begin
    if p_action = 'VISU' then
    select TSourceObject(B.bdw_name, P.prop_bdw_name)
    bulk collect into p_tab
    from T_NETWORK_CHANNEL N, t_bdw_mw B, t_prop_bdw_mw P
    where B.comp_bdw = P.comp_bdw and P.comp_prop_bdw = N.comp_prop_bdw
    and EXISTS (SELECT 1
    FROM t_channel_element C
    WHERE N.comp_network_channel = C.comp_network_channel and comp_lien = p_lien);
    else
    select TSourceObject(B.bdw_name, P.prop_bdw_name)
    bulk collect into p_tab
    from T_NETWORK_CHANNEL N, t_bdw_mw B, t_prop_bdw_mw P
    where B.comp_bdw = P.comp_bdw and P.comp_prop_bdw = N.comp_prop_bdw;
    end if;
    end;
    Then I created the datablock with the wizard , I entered correctly the value of the arguments for the table type name, the argument p_action and the argument p_lien.
    And when compiling there was this alert error :
    Compiling QUERY-PROCEDURE trigger on NETWORK_CHANNEL_MIRROR data block...
    Compilation error on QUERY-PROCEDURE trigger on NETWORK_CHANNEL_MIRROR data block:
    PL/SQL ERROR 960 at line 5, column 9
    RPCs cannot use variables with schema level user-defined types in this release
    PL/SQL ERROR 0 at line 5, column 9
    Item ignored
    PL/SQL ERROR 320 at line 7, column 26
    the declaration of the type of this expression is incomplete or malformed
    PL/SQL ERROR 0 at line 7, column 1
    Statement ignored
    PL/SQL ERROR 320 at line 8, column 28
    the declaration of the type of this expression is incomplete or malformed
    PL/SQL ERROR 0 at line 8, column 1
    Statement ignored
    Compilation errors have occurred.
    So what should I do ?
    Thank you very much indeed.

    I create the package , and when creating the body then there was an error.
    Here is the package :
    create or replace package pkg_query_ntwrk_chnl_mirror
    is
    type TSourceObject is record(name varchar2(30), propname varchar2(200));
    type TSourceTable is table of TSourceObject index by binary_integer;
    procedure p_query_ntwk_chnl_mirror(p_tab IN OUT NOCOPY pkg_query_ntwrk_chnl_mirror.TSourceTable, p_action varchar2, p_lien number);
    end;
    create or replace package body pkg_query_ntwrk_chnl_mirror
    is
    procedure p_query_ntwk_chnl_mirror(p_tab IN OUT NOCOPY pkg_query_ntwrk_chnl_mirror.TSourceTable, p_action varchar2, p_lien number)
    is
    begin
    if p_action = 'VISU' then
         select B.bdw_name, P.prop_bdw_name
         bulk collect into p_tab
         from T_NETWORK_CHANNEL N, t_bdw_mw B, t_prop_bdw_mw P
         where B.comp_bdw = P.comp_bdw and P.comp_prop_bdw = N.comp_prop_bdw
         and EXISTS (SELECT 1
         FROM t_channel_element C
         WHERE N.comp_network_channel = C.comp_network_channel and comp_lien = p_lien);
    else
         select B.bdw_name, P.prop_bdw_name
         bulk collect into p_tab
         from T_NETWORK_CHANNEL N, t_bdw_mw B, t_prop_bdw_mw P
         where B.comp_bdw = P.comp_bdw and P.comp_prop_bdw = N.comp_prop_bdw;
    end if;
    end;
    end;
    And here is the error :
    7/2 PL/SQL: SQL Statement ignored
    8/20 PLS-00597: expression 'P_TAB' in the INTO list is of wrong type
    15/2 PL/SQL: SQL Statement ignored
    16/20 PLS-00597: expression 'P_TAB' in the INTO list is of wrong type
    And what is the problem here ? I think it is right!

  • Error in stored procedure

    When i executed the below query I got no error and o/p is inserted into RECON_RESULTS table
    INSERT into RECON_RESULTS(contract,plan_code,issue_date,product_type,status,"mode",bill_to_date)
    SELECT TBL_SRC.CONTRACT,
    CASE WHEN ((TBL_SRC.PLAN_CODE IS NOT NULL) AND (TBL_TRGT.PLAN_CODE IS NULL))
    THEN 3
    WHEN NVL(TBL_SRC.PLAN_CODE,0) != NVL(TBL_TRGT.PLAN_CODE,0)
    THEN 0
    WHEN NVL(TBL_SRC.PLAN_CODE,0) = NVL(TBL_TRGT.PLAN_CODE,0)
    THEN 1
    END PLAN_CODE,
    CASE WHEN TBL_SRC.ISSUE_DATE =TBL_TRGT.ISSUE_DATE
    THEN 1
    ELSE 0
    END ISSUE_DATE,
    TBL_SRC.product_type,
    TBL_SRC.STATUS,
    NVL(TBL_SRC."MODE",3) AS "MODE" ,
    CASE WHEN ((TBL_SRC.BILL_TO_DATE IS NOT NULL) AND (TBL_TRGT.BILL_TO_DATE IS NULL))
    THEN 3
    WHEN NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'dd/mm/yyyy'),0) != NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'dd/mm/yyyy'),0)
    THEN 0
    WHEN NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'dd/mm/yyyy'),0) = NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'dd/mm/yyyy'),0)
    THEN 1
    END BILLDATE
    FROM TBL_SRC LEFT JOIN TBL_TRGT ON TBL_SRC.CONTRACT = TBL_TRGT.CONTRACT;
    But when I placed the above query in Procedure it is throwing error
    create or replace
    PROCEDURE PROCEDURE2 AS
    AA TBL_SRC.CONTRACT%TYPE;
    BB RECON_RESULTS.PLAN_CODE%TYPE;
    CC RECON_RESULTS.ISSUE_DATE%TYPE;
    DD RECON_RESULTS.PRODUCT_TYPE%TYPE;
    EE RECON_RESULTS.STATUS%TYPE;
    FF RECON_RESULTS."MODE"%TYPE;
    GG RECON_RESULTS.BILL_TO_DATE%TYPE;
    BEGIN
    SELECT TBL_SRC.CONTRACT,
    CASE WHEN ((TBL_SRC.PLAN_CODE IS NOT NULL) AND (TBL_TRGT.PLAN_CODE IS NULL))
    THEN 2
    WHEN NVL(TBL_SRC.PLAN_CODE,0) != NVL(TBL_TRGT.PLAN_CODE,0)
    THEN 0
    WHEN NVL(TBL_SRC.PLAN_CODE,0) = NVL(TBL_TRGT.PLAN_CODE,0)
    THEN 1
    END ,
    TBL_SRC.product_type,
    TBL_SRC.STATUS,
    NVL(TBL_SRC."MODE",3),
    CASE WHEN ((TBL_SRC.BILL_TO_DATE IS NOT NULL) AND (TBL_TRGT.BILL_TO_DATE IS NULL))
    THEN 2
    WHEN NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'DD-MON-YYYY'),0) != NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'DD-MON-YYYY'),0)
    THEN 0
    WHEN NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'DD-MON-YYYY'),0) = NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'DD-MON-YYYY'),0)
    THEN 1
    END,
    CASE WHEN ((TBL_SRC.ISSUE_DATE IS NOT NULL) AND (TBL_TRGT.ISSUE_DATE IS NULL))
    THEN 2
    WHEN NVL(TO_CHAR(TBL_SRC.ISSUE_DATE,'DD-MON-YYYY'),0) != NVL(TO_CHAR(TBL_SRC.ISSUE_DATE,'DD-MON-YYYY'),0)
    THEN 0
    WHEN NVL(TO_CHAR(TBL_SRC.ISSUE_DATE,'DD-MON-YYYY'),0) = NVL(TO_CHAR(TBL_SRC.ISSUE_DATE,'DD-MON-YYYY'),0)
    THEN 1
    END
    INTO AA,BB,DD,EE,FF,GG,CC
    FROM TBL_SRC LEFT JOIN TBL_TRGT ON TBL_SRC.CONTRACT = TBL_TRGT.CONTRACT;
    END PROCEDURE2;
    Error Message:
    Error(13,2): PL/SQL: SQL Statement ignored
    Error(24,5): PL/SQL: ORA-00932: inconsistent datatypes: expected DATE got NUMBER

    I have changed the datatype of issue_date and bill_to_date to number and used insert into tablename ...select but my SP is throwing
    warining (8,2): PLW-07202: bind type would result in conversion away from col
    so I have diabled the warnings
    ALTER SYSTEM SET PLSQL_WARNINGS = 'DISABLE:ALL';
    Now my SP complied successfully.
    Then I tried running the SP
    EXECUTE PROCEDURE2;
    It is throwing the error ORA-00900-"Invalid SQL Statement".
    My complied SP
    create or replace
    PROCEDURE PROCEDURE2 AS
    BEGIN
    INSERT into RECON_RESULTS(contract,plan_code,issue_date,product_type,status,bill_form,bill_to_date)
    SELECT TBL_SRC.CONTRACT,
    CASE WHEN ((TBL_SRC.PLAN_CODE IS NOT NULL) AND (TBL_TRGT.PLAN_CODE IS NULL))
    THEN 3
    WHEN NVL(TBL_SRC.PLAN_CODE,0) != NVL(TBL_TRGT.PLAN_CODE,0)
    THEN 0
    WHEN NVL(TBL_SRC.PLAN_CODE,0) = NVL(TBL_TRGT.PLAN_CODE,0)
    THEN 1
    END PLAN_CODE,
    CASE WHEN TBL_SRC.ISSUE_DATE =TBL_TRGT.ISSUE_DATE
    THEN 1
    ELSE 0
    END ISSUE_DATE,
    TBL_SRC.product_type,
    TBL_SRC.STATUS,
    NVL(TBL_SRC."MODE",3) AS "MODE" ,
    CASE WHEN ((TBL_SRC.BILL_TO_DATE IS NOT NULL) AND (TBL_TRGT.BILL_TO_DATE IS NULL))
    THEN 3
    WHEN NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'DD-MON-YYYY'),0) != NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'DD-MON-YYYY'),0)
    THEN 0
    WHEN NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'DD-MON-YYYY'),0) = NVL(TO_CHAR(TBL_SRC.BILL_TO_DATE,'DD-MON-YYYY'),0)
    THEN 1
    END BILLDATE
    FROM TBL_SRC LEFT JOIN TBL_TRGT ON TBL_SRC.CONTRACT = TBL_TRGT.CONTRACT;
    END PROCEDURE2;

  • Problem during mapping when stored procedures is used

    Dear All,
    I am doing one File-XI-JDBC scenario using stored procedures.
    My source Data Type is like:
    MT_HEADER 1..1
          PRODH    1..1  xsd:string
          VTEXT      1..1  xsd.string
          DATUM    1..1  xsd.string
    My target Data Type is like:
    MT_HEADER    1..1
      Statement        1..1   
       SP_UPDATE  1..1
        action            required   xsd.string
        PRODH         1..1         xsd.string
          isInput         optional   xsd.string
          type            optional   xsd.string
        VTEXT          1..1         xsd.string
          isInput        optional    xsd.string
          type           optional    xsd.string
        DATUM        1..1          xsd.string
          isInput       optional     xsd.string
          type          optional     xsd.string
    In the mapping, EXECUTE>action; true>isInput; CHAR-->type; SP_UPDATE- stored procedure name in DB.
    When I am testing the message mapping its giving no errors but when i am processing the file it gives me following error:
    <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_MM_TEST_FILE_JDBC_T179T_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>RuntimeException in Message-Mapping transformatio~</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>During the application mapping com/sap/xi/tf/_MM_TEST_FILE_JDBC_T179T_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: RuntimeException in Message-Mapping transformatio~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
    Can anyone please guide what error I am making in the data type or in the mapping.
    Warm Regards,
    N.Jain

    Hi Nishu,
    The reason of this error is A message mapping is executed on the integration server at mapping runtime. A value mapping is called within the message mapping. If you did not maintain the values required for the mapping (Directory -> Tools -> Value mapping), an exception (BaseRuntimeException) occurs and the processing of the message is terminated.
    So please do this :
    1. Maintain the value mapping in the directory.
    2. To change the behavior in the case of an error, you must import a Support Package. Message processing is then no longer terminated. Instead, a warning appears in the log and the initial value is copied unchanged to the target document.
    Note: The behavior described only affects message mappings, that is, mappings generated using the graphic tool. If, on the other hand, you call the value mapping within a Java mapping and this fails, you receive a KeyMappingException. It is then the task of the Java mapping to react to this exception.
    Hope this will help you.
    Regards
    Aashish Sinha
    PS : reward points if helpful

Maybe you are looking for

  • How to create a tree view to show hierarchy

    Hi all, i am new in plugin development.i need help in creating a tree view to show hierarchy.i gone through sdk\paneltreeview example.but not getting clear idea how to create child node.and how to display it..i want to create a simple tree view which

  • How can I fix Photoshop Elements 5.0 Organizer as it stopped loading new photos?

    I have used Photoshop Elements 5.0 for several years.  It has stopped receiving the new downloaded photos.  How do I fix this?  (I tried running the "setup" again but I get a message that it is already loaded.)

  • Multi-Master Replication Limits

    I'm starting new project and would like ask your opinion. They like to have multi-master replication of a single table between Chicago and Denver. A record could be written in Denver, then same row read in Chicago. The opposite is also true. Replicat

  • Contribute cs4 upgrade/update

    Is there an upgrade/update to contribute cs4 or do we have to purchase cs5?  Our web site server was updated & it will not run on cs4.

  • Add field in output list in ZRFUMSV00

    Hi: I am facing a problem with Z version of RFUMSV00 program. I have created a variant with a new output list, bur I need to add some new fields in output list, but I only can add the some fields in a list, but I don´t know how to add different field