Error - remote stored procedure includes in a function

Hi,
I have a stored procedure, it runs properly
ecos.GetCustTier@BSCSDEV in PL/SQL
But after included into function F_GETCUSTTIER, it comes error.
SQL> select f_getcusttier(585510,'20020808') from dual
ORA-06571: Function F_GETCUSTTIER does not guarantee not to update database
[Function F_GETCUSTTIER]
create or replace FUNCTION f_getcusttier(
Begin
ecos.GetCustTier@BSCSDEV(i_customer_id, i_at_date, o_seqno, o_custcode, o_tier_id, o_tier_des, o_join_date, o_join_reason,
o_renewal_date, o_next_review_date, o_last_review_amt_no, o_exit_date, o_exit_reason,
o_input_by, o_input_date, o_update_by, o_update_date, o_expiry_date, o_next_job_review_date,
o_status_id, o_return_code);
RETURN o_tier_id;
I also try to create a package for this function
CREATE OR REPLACE PACKAGE abc AS
FUNCTION f_getcusttier(i_customer_id number, i_at_date varchar2) RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES(f_getcusttier, WNDS);
END abc;
CREATE OR REPLACE PACKAGE BODY bwan AS
FUNCTION f_getcusttier(
i_customer_id in number,
i_at_date in varchar2
Begin
ecos.GetCustTier@BSCSDEV(i_customer_id, i_at_date, o_seqno, o_custcode, o_tier_id, o_tier_des, o_join_date, o_join_reason,
o_renewal_date, o_next_review_date, o_last_review_amt_no, o_exit_date, o_exit_reason,
o_input_by, o_input_date, o_update_by, o_update_date, o_expiry_date, o_next_job_review_date,
o_status_id, o_return_code);
RETURN o_tier_id;
But with Warning: Package Body created with compilation errors.
2/1 PLS-00452: Subprogram 'F_GETCUSTTIER' violates its associated
pragma
How can I fixed it? Can function pack with remote stored procedure?
DB version: 8.0.4.4.0
I know that this problem is resolved in Release 8.1, is it no solution for release 8.0.4.4.0?

First of all, please do not post three separate threads for the one problem. It simply clutters up the forum for the rest of us.
Prior to 8i you need to explicitly guarantee that your function does not write to the database. You do this with the RESTRICT_REFERENCES pragma:
CREATE PACKAGE yr_package AS  -- package specification
   FUNCTION whatever
         (pn IN NUMBER) RETURN NUMBER;
   PRAGMA RESTRICT_REFERENCES (whatever, WNDS);
END yr_package;The following link goes to a page of helpful stuff assembeled by some of use regulars:Re: How to attach a java bean in forms6i
It includes jumps to the Oracle online documentation. You may find the Application Developer's Guide - Fundamentals an instructive read.
Regards, APC

Similar Messages

  • Remote Stored Procedure Call Dispatcher WEB WERVICE

    Hello all,
    Environment: Windows OS, Oracle 10g, mod_plsql
    I am looking for solutions to the following problem:
    A way to dispatch calls to stored procedures from client to server with a minimal impact on performance.
    We are looking at two possible solutions:
    1) Making a call to a Remote Stored Procedure Call Dispatcher (RSPCDispatcher) stored procedure through mod_plsql.
    2) Making a call to a Remote Stored Procedure Call Dispatcher (RSPCDispatcher) stored procedure through a web service.
    Solution 1) is not the preferred one as you may already know that mod_plsql will not be supported starting 12g.
    Solution 2) is the one we prefer as we believe that web services will be ever more supported in the future. When we move to 11g we may turn this web service into a native one (avoiding overhead in the OC4J for hosting the web service etc.).
    We are looking for code examples and information pointers of how we could implement this dispatcher as a stored procedure in a DB package. We know that the implementation should be similar to the one done for mod_plsql in the OWA schema but the code there is obfuscated, so we could not borrow ideas from there.
    We are not sure how to deal with the generalization of the above stated problem. We need to be able to pass to this dispatcher the stored procedure package and name we are invoking, ordered list of parameters (or parameters map), and the transport strategy (XML, JSON, etc.).
    Basically, we are notsure how to deal with the USING clause of the EXECUTE IMMEDIATE statement. We can dynamically generate the SQL statement corresponding to the stored procedure we want to call, but we are not sure how to bind the parameters we are passing?
    Also, we know that EXECUTE IMMEDIATE may be slow sometimes. So if could avoid it, this could further improve performance.
    Perhaps the run-time generalized stored procedure execution may not be what we are looking for?! Perhaps we should include several design-time steps?! What about a script that given a package name (or just a single stored procedure) would generate a wrapper package which stored procudures' names would correspond to their respective counterparts in the given package which would take two parameters - the list of parameters in some sort of format, and the transport (content delivery strategy) and would return the result in the given content delivery strategy?! This script may also define the XSD of the XML message a stored procedure is called with (the parameter map) as well as the XSD of the XML result the stored procedure returns. Also the script could generate client code with the given language strategy (Java, .NET, etc.) for calling the RSPCDispatcher web service.
    We request the following from the Oracle community folks:
    a) Please, give us any relevant information that could be helpful to resolve this problem.
    b) Any resource of how to inspect stored procedures in a package, its parameters, parameter types and direction (IN, OUT, or INOUT), etc.
    Thank you very much in advance.
    Regards,
    Georgi

    Hello all,
    Environment: Windows OS, Oracle 10g, mod_plsql
    I am looking for solutions to the following problem:
    A way to dispatch calls to stored procedures from client to server with a minimal impact on performance.
    We are looking at two possible solutions:
    1) Making a call to a Remote Stored Procedure Call Dispatcher (RSPCDispatcher) stored procedure through mod_plsql.
    2) Making a call to a Remote Stored Procedure Call Dispatcher (RSPCDispatcher) stored procedure through a web service.
    Solution 1) is not the preferred one as you may already know that mod_plsql will not be supported starting 12g.
    Solution 2) is the one we prefer as we believe that web services will be ever more supported in the future. When we move to 11g we may turn this web service into a native one (avoiding overhead in the OC4J for hosting the web service etc.).
    We are looking for code examples and information pointers of how we could implement this dispatcher as a stored procedure in a DB package. We know that the implementation should be similar to the one done for mod_plsql in the OWA schema but the code there is obfuscated, so we could not borrow ideas from there.
    We are not sure how to deal with the generalization of the above stated problem. We need to be able to pass to this dispatcher the stored procedure package and name we are invoking, ordered list of parameters (or parameters map), and the transport strategy (XML, JSON, etc.).
    Basically, we are notsure how to deal with the USING clause of the EXECUTE IMMEDIATE statement. We can dynamically generate the SQL statement corresponding to the stored procedure we want to call, but we are not sure how to bind the parameters we are passing?
    Also, we know that EXECUTE IMMEDIATE may be slow sometimes. So if could avoid it, this could further improve performance.
    Perhaps the run-time generalized stored procedure execution may not be what we are looking for?! Perhaps we should include several design-time steps?! What about a script that given a package name (or just a single stored procedure) would generate a wrapper package which stored procudures' names would correspond to their respective counterparts in the given package which would take two parameters - the list of parameters in some sort of format, and the transport (content delivery strategy) and would return the result in the given content delivery strategy?! This script may also define the XSD of the XML message a stored procedure is called with (the parameter map) as well as the XSD of the XML result the stored procedure returns. Also the script could generate client code with the given language strategy (Java, .NET, etc.) for calling the RSPCDispatcher web service.
    We request the following from the Oracle community folks:
    a) Please, give us any relevant information that could be helpful to resolve this problem.
    b) Any resource of how to inspect stored procedures in a package, its parameters, parameter types and direction (IN, OUT, or INOUT), etc.
    Thank you very much in advance.
    Regards,
    Georgi

  • Calling Remote Stored Procedure from Pocket PC

    Hi all,
    I have finished building an application based on IBM's SMF framework which conforms to the OSGI standards. Currently, I am having a problem with connecting to the main server DB which resides on a Websphere server. Basically, user will enter information on their pocket pc and then save it to a local DB2e database. I thought about going with the synchronization solution with the DB2 Sync server, but really all the user is trying to do is updating records in the main server database tables and there's really no need to sync anything back from the server to the pocket pc. So, I m thinking maybe I should try to invoke a stored procedure that resides on the main DB server from my device, passing in parameters through a WLAN connection.
    My question now is:
    1. user should be connecting through a WLAN connection and my company have set up a login that prompts the user to login everytime they try to access anything on the server. It won't be nice if the user will hv to do that every single time. Is there a way that I can log the user in programmatically so they do not have to do it with a separate log in window?
    2. Is calling a remote stored procedure a bad idea?
    3. If the network goes down, then there's no way the users can update anything to the main server DB. So, the changes will be saved locally and once the network goes back up, the user should be able to update those changes back to the server. I am just wondering if it's bad to do a loop and send those updates to the server by calling the stored procedures repeatedly passing in diff. parameters? what safeguards do I need to put in? like what exceptions should I expect to catch? also, I would like to be able to track those updates that failed, how do I do that?
    Any help will be appreciated. I tried to find resources online, but to no avail. I am not sure if I am overly complicated things. Please advice! Thanks alot everyone!

    The error message is:
    ORA-04067: not executed, stored procedure "schema.P$PROC@remote_db" does not exist

  • Can a SQL Server stored procedure call an SAP function module?

    Can a SQL Server stored procedure call an SAP function module.? The stored procedure will be called via a trigger when data records are added to a Z table.

    You have two options:
    - the other software can use the RFC SDK and call directly in the system
    - the other software can use a database connect
    Markus

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

  • 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

  • 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 calling stored procedure from MFC using odbc

    Hello,
    I am using MFC to call a stored procedure written in PL/SQL, but when I make the call I get the next error in Spanish:
    "No se enlazaron columnas antes de llamar a SQLFetchScroll o SQLExtendedFetch", which more or less in English means:
    "No rows were binded before calling SQLFetchScroll or SQLExtendedFetch".
    I am using a CRecordset derived class to access the stored procedure. I am unable to find the error.
    THE STORED PROCEDURE'S HEADER:
    Sp_Int_Ot_Ordendetrabajoalta ( lineatrabajo NUMBER, lv_orden NUMBER, usuario
    VARCHAR2, idvehiculo NUMBER, fechamax1 VARCHAR2, resumen VARCHAR2, detalle
    VARCHAR2,
    coderp VARCHAR2, numtrabrecibidos NUMBER, lv_CODOT VARCHAR2, retorno OUT
    INTEGER)
    THE .H FOR THE CRECORDSET DERIVED CLASS (Visual Studio 6 comments removed)
    class CRecSP : public CRecordset
    public:
    CRecSP(CDatabase* pDatabase = NULL);
    DECLARE_DYNAMIC(CRecSP)
    CString m_szSQL;
    long m_RETORNO;
    virtual CString GetDefaultConnect();
    virtual CString GetDefaultSQL();
    virtual void DoFieldExchange(CFieldExchange* pFX);
    THE .CPP FOR THE CLASS (VS6 comments removed)
    IMPLEMENT_DYNAMIC(CRecSP, CRecordset)
    CRecSP::CRecSP(CDatabase* pdb) : CRecordset(pdb)
    m_RETORNO = 0;
    m_nParams = 1;
    m_nDefaultType = snapshot;
    CString CRecSP::GetDefaultConnect()
    return T( DBCONNECTION_STRING );
    CString CRecSP::GetDefaultSQL()
    return m_szSQL;
    void CRecSP::DoFieldExchange(CFieldExchange* pFX)
    pFX->SetFieldType(CFieldExchange::outputParam);
    RFX_Long(pFX, _T("[retorno]"), m_RETORNO );
    USING THE CRECORDSET DERIVED CLASS: (Vars read from EditBoxes as CStrings
    and formatted in the SQL)
    CRecSP *rec = new CRecSP(&db);
    szSQL.Format( "{CALL
    FGROT2005.SP_INT_OT_ORDENDETRABAJOALTA(%s,%s,'%s',%s,'%s','%s','%s','%s',%s,'%s',?)}",
    szLinea, szOrden, "USER", szIdVeh, szFechaMax, szResumen,
    szDetalle, "ERP", "0", szCodOT
    rec->m_szSQL = szSQL;
    //rec->Open( CRecordset::forwardOnly,szSQL,CRecordset::readOnly );
    rec->Open( );
    iError = rec->m_RETORNO;
    rec->Close();

    This forum is meant for discussions about OTN content/site and services.
    Questions about Oracle products and technologies will NOT be answered in this forum. Please post your product or technology related questions in the appropriate product or technology forums, which are monitored by Oracle product managers.
    Product forums:
    http://forums.oracle.com/forums/index.jsp?cat=9
    Technology forums:
    http://forums.oracle.com/forums/index.jsp?cat=10

  • Error Calling Stored Procedure Receiver adapter

    Hi Guys,
    I am trying to send data to a stored procedure SQL server R2 2008 from SAP PI7.11.
    Transport Protocol: JDBC2.0
    Message Protocol : XMLSQLFORMAT
    I am able to read from same database using sender adapter.
    Name of SP:  InderTest
    Paramters in SP :      @Carrier Varchar(20), @Location Varchar(20), @Product Varchar(20), @Zone Varchar(20),
         @dteStart date, @dteEnd date, @strType Varchar(1),     @intRate Float
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_FreightPricing xmlns:ns0="http://na.holcim.com/pi/o2c/pricingmaster">
    - <StatementName1>
    - <InderTest action="EXECUTE">
      <table>InderTest</table>
      <Carrier isInput="true" type="VARCHAR">4000004</Carrier>
      <Location isInput="true" type="VARCHAR">3600</Location>
      <Product isInput="true" type="VARCHAR">3553</Product>
      <Zone isInput="true" type="VARCHAR">Zone1</Zone>
      <dteStart isInput="true" type="DATE">20110704</dteStart>
      <dteEnd isInput="true" type="DATE">20120704</dteEnd>
      <strType isInput="true" type="VARCHAR">A</strType>
      <intRate isInput="true" type="FLOAT">10.00</intRate>
      </InderTest>
      </StatementName1>
      </ns0:MT_FreightPricing>
    Error in JDBC Receiver
    Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'InderTest' (structure 'StatementName1'): java.lang.IllegalArgumentException
    Any clue...
    I was reading this help document. They have mentioned 5 configuration step, i have worked on JDBC earlier but never did anything like that.... Any idea ?
    http://help.sap.com/saphelp_nw70/helpdata/en/b0/676b3c255b1475e10000000a114084/content.htm
    Regards
    Inder

    <table> element is optional in the structure. In that case you can try:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:MT_FreightPricing xmlns:ns0="http://na.holcim.com/pi/o2c/pricingmaster">
    <StatementName1>
    <InderTest action="EXECUTE">
    <Carrier isInput="true" type="VARCHAR">4000004</Carrier>
    <Location isInput="true" type="VARCHAR">3600</Location>
    <Product isInput="true" type="VARCHAR">3553</Product>
    <Zone isInput="true" type="VARCHAR">Zone1</Zone>
    <dteStart isInput="true" type="DATE">20110704</dteStart>
    <dteEnd isInput="true" type="DATE">20120704</dteEnd>
    <strType isInput="true" type="VARCHAR">A</strType>
    <intRate isInput="true" type="FLOAT">10.00</intRate>
    </InderTest>
    </StatementName1>
    </ns0:MT_FreightPricing>
    Regards
    Raj

  • Error calling stored procedure from MFC.

    Hello,
    I am using MFC to call a stored procedure written in PL/SQL, but when I make the call I get the next error in Spanish:
    "No se enlazaron columnas antes de llamar a SQLFetchScroll o SQLExtendedFetch", which more or less in English means:
    "No rows were binded before calling SQLFetchScroll or SQLExtendedFetch".
    I am using a CRecordset derived class to access the stored procedure. I am unable to find the error.
    THE STORED PROCEDURE'S HEADER:
    Sp_Int_Ot_Ordendetrabajoalta ( lineatrabajo NUMBER, lv_orden NUMBER, usuario
    VARCHAR2, idvehiculo NUMBER, fechamax1 VARCHAR2, resumen VARCHAR2, detalle
    VARCHAR2,
    coderp VARCHAR2, numtrabrecibidos NUMBER, lv_CODOT VARCHAR2, retorno OUT
    INTEGER)
    THE .H FOR THE CRECORDSET DERIVED CLASS (Visual Studio 6 comments removed)
    class CRecSP : public CRecordset
    public:
    CRecSP(CDatabase* pDatabase = NULL);
    DECLARE_DYNAMIC(CRecSP)
    CString m_szSQL;
    long m_RETORNO;
    virtual CString GetDefaultConnect();
    virtual CString GetDefaultSQL();
    virtual void DoFieldExchange(CFieldExchange* pFX);
    THE .CPP FOR THE CLASS (VS6 comments removed)
    IMPLEMENT_DYNAMIC(CRecSP, CRecordset)
    CRecSP::CRecSP(CDatabase* pdb) : CRecordset(pdb)
    m_RETORNO = 0;
    m_nParams = 1;
    m_nDefaultType = snapshot;
    CString CRecSP::GetDefaultConnect()
    return T( DBCONNECTION_STRING );
    CString CRecSP::GetDefaultSQL()
    return m_szSQL;
    void CRecSP::DoFieldExchange(CFieldExchange* pFX)
    pFX->SetFieldType(CFieldExchange::outputParam);
    RFX_Long(pFX, _T("[retorno]"), m_RETORNO );
    USING THE CRECORDSET DERIVED CLASS: (Vars read from EditBoxes as CStrings
    and formatted in the SQL)
    CRecSP *rec = new CRecSP(&db);
    szSQL.Format( "{CALL
    FGROT2005.SP_INT_OT_ORDENDETRABAJOALTA(%s,%s,'%s',%s,'%s','%s','%s','%s',%s,'%s',?)}",
    szLinea, szOrden, "USER", szIdVeh, szFechaMax, szResumen,
    szDetalle, "ERP", "0", szCodOT
    rec->m_szSQL = szSQL;
    //rec->Open( CRecordset::forwardOnly,szSQL,CRecordset::readOnly );
    rec->Open( );
    iError = rec->m_RETORNO;
    rec->Close();

    I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 12
    Here is example for my test procedure:
    declare
    v_session_id_tab SESSION_ID_TAB_TYPE;
    v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
    v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
    v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
    v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
    v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
    v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
    v_status_tab STATUS_TAB_TYPE;
    v_notes_tab NOTES_TAB_TYPE;
    begin
    v_session_id_tab(1) := 1;
    v_service_type_tab(1) := 'db';
    v_service_location_tab(1) := 'local';
    v_service_call_name_tab(1) := 'Name of call';
    v_service_call_start_time_tab(1) := SYSDATE;
    v_service_call_end_time_tab(1) := SYSDATE;
    v_service_call_duration_tab(1) := 100;
    v_status_tab(1) := 'Z';
    v_notes_tab(1) := 'NOTES';
    BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
    v_service_call_duration_tab, v_status_tab, v_notes_tab);
    end;
    I declare all types at schema level.
    Please give your comments.
    Thank you

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

  • SQLJ error in stored procedure

    Okay I'm kind of new to this stuff so this is probably an easy
    question but I can't fix my current problem. Know I have been
    creating and compiling several java stored procedures in my
    oracle 8.1.7.0.0 enterprise edition database. So far everything
    is create I have created about a dozen and done all of their
    call specs and everything works without a hitch.
    The problem I have came into being when I tried to create a
    stored procedure that uses SQLJ. When I create my stored
    procedures I compile my java code straight into the database
    using the
    CREATE OR REPLACE AND COMPILE JAVA SOURCE named "myClass" AS
    source
    this has always worked from me except when I place my
    #sql ; lines at which point it issues a the following error
    SP2-7034 : unknown command beginning
    at which point is it ignores the line of code and continues to
    compile my java source. Does this mean the SQLJ is not enabled
    in my database or what? I have checked out the SQLJ developer&#8217;s
    hand book and it did not help me with this problem. Oh please
    wont some wise oracle god help me!

    user21354 wrote:
    i am creating the collection in my Stored procedure it is giving me this error
    declare
    type t_number is table of number;
    v_numbers t_number;
    begin
    select VISIT_ID
    bulk collect into v_numbers
    from visit
    where VISITTYPEID = 2;
    select VISIT_ID from v_numbers;
    end;
    error
    PL/SQL: ORA-00942: table or view does not exist
    please tell me this why this happeningcouple of things...
    context switching - Your second 'select visit_id' query is actually parsed outside plsql, in the 'sql engine'. This sql engine has no knowledge of what v_numbers is, it's expecting an actual table name but it can't find anything called v_numbers in it's metadata. So it bombs out with that error. Google 'context switching plsql' for more info. :o)
    - as v_numbers is a collection, you could just loop through the results:
      for n in 1..v_numbers.count
      loop
        dbms_output.put_line(v_numbers(n));
      end loop;- as stated above, a 'select' without 'into' won't work in plsql anyway.
    - there is a way of getting round the context switch, by creating your Type in sql rather than plsql and 'casting' it to a table. Let us know if you want to know the steps to do it, but try reading up on context switch first.
    cheers.

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

  • Invalid Month error in stored procedure

    Hello, I have a simple stored procedure that I pass a begin and end date into and it is complaining about the date formatting. Below is the table layout and stored procedure in question. How can I format the date for example as MM-DD-YYYY and not have it complain? I have tried using TO_DATE and TO_CHAR and it still complains.
    Thank you.
    -- Table
    CREATE TABLE INV_MOVE_ARCHIVE
    *( "RETAILER_ID" NUMBER NOT NULL,*
    *"SKU_ID" VARCHAR2(18 BYTE) NOT NULL,*
    *"OUTLET_ID" VARCHAR2(20 BYTE) NOT NULL,*
    *"QTY_CHANGE" NUMBER NOT NULL,*
    *"TRANS_DATE" DATE DEFAULT sysdate*
    -- Stored procedure
    CREATE OR REPLACE PROCEDURE inv_move_update(beginDate IN DATE, endDate IN DATE, retailerId IN INT)
    IS
    skuId VARCHAR(18);
    outletId VARCHAR(20);
    qtyChange INTEGER;
    -- Declaring the cursor
    CURSOR getInvRecord IS
    SELECT
    sku_id,
    outlet_id,
    qty_change
    INTO
    skuId,
    outletId,
    qtyChange
    FROM
    inv_move_archive
    WHERE
    retailer_id = retailerId AND
    trans_date &gt;= beginDate AND
    trans_date &lt;= endDate;
    BEGIN
    FOR rec_getInvRecord IN getInvRecord LOOP
    UPDATE OUTLET_SKU_XREF
    SET qty = qty + qtyChange
    WHERE outlet_id = outletId
    AND sku_id = skuId;
    COMMIT;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    IF getInvRecord%isopen THEN CLOSE getInvRecord;
    END IF;
    END inv_move_update;
    */*

    Okay, I do not wantto change the table. I believe thatthe Java developers will need to change their code to call this procedure correctly. Another iss I am having is when I call this procedure manually from the database is is NOT doing the update. I put some debug statements in it and they indicate that the update statement is NOT updating any rows. If I run the select statement that is in the sp using the same parameters I pass into the sp it comes back with 1 row. The row to be updated is present in the table being updated.
    -- Here is my sp call
    DECLARE
      BEGINDATE DATE;
      ENDDATE DATE;
      RETAILERID NUMBER;
    BEGIN
      BEGINDATE := to_date('01/07/2009 00:00:00', 'MM/DD-YYYY HH24:MI:SS');
      ENDDATE := to_date('01/07/2009 11:59:59', 'MM/DD-YYYY HH24:MI:SS');
      RETAILERID := 104;
      INV_MOVE_UPDATE(
        BEGINDATE => BEGINDATE,
        ENDDATE => ENDDATE,
        RETAILERID => RETAILERID
    END;
    -- Select statement with same values
    SELECT
       sku_id,
       outlet_id,
       qty_change
    FROM
       inv_move_archive
    WHERE
       retailer_id = 104 AND
       trans_date >= to_date('01/07/2009 00:00:00', 'MM/DD-YYYY HH24:MI:SS') AND
       trans_date <= to_date('01/07/2009 11:59:59', 'MM/DD-YYYY HH24:MI:SS')
    -- Results from select
    036266579804040     9900165     500
    -- Here is the procedure with the debug statements in it.
    CREATE OR REPLACE PROCEDURE inv_move_update(beginDate IN DATE, endDate IN DATE, retailerId IN  INT)
    IS
            skuId VARCHAR(18);
            outletId VARCHAR(20);
            qtyChange NUMBER;
            errorMessage  VARCHAR(2500) := NULL;       
    -- Declaring the cursor
    CURSOR getInvRecord IS
          SELECT
             sku_id,
             outlet_id,
             qty_change
          INTO
             skuId,
             outletId,
             qtyChange
          FROM
             inv_move_archive
          WHERE
             retailer_id = retailerId AND
             trans_date >= beginDate AND
             trans_date <= endDate;
    BEGIN
       FOR rec_getInvRecord IN getInvRecord LOOP
          DBMS_OUTPUT.PUT_LINE('Rows Updated: ' || SQL%ROWCOUNT);
          UPDATE OUTLET_SKU_XREF
           SET qty = qty + qtyChange
          WHERE outlet_id = outletId
                AND sku_id = skuId;
          DBMS_OUTPUT.PUT_LINE('SKUID: ' || skuId);
          DBMS_OUTPUT.PUT_LINE('Rows Updated: ' || SQL%ROWCOUNT);
          COMMIT;       
       END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
        errorMessage := 'Error updating the OUTLET_SKU_XREF table: ' || SQLCODE || ':' || SQLERRM;
        RAISE_APPLICATION_ERROR(-20001,errorMessage);
        DBMS_OUTPUT.PUT_LINE(errorMessage);
        IF getInvRecord%isopen THEN CLOSE getInvRecord;
        END IF;  
    END inv_move_update;
    /I get no errors when running it. The DBMS_OUTPUT shows null for the skuId and 0 for Rows Updated. Like I said I ran the select manually and it returns a row and I see that the row does exist in the target table. Any ideas what is going on here?
    Thank you
    -- David

  • Trapping error in stored procedure

    Hi all,
    I forms 6i application development, i mostly called backend procedure ( Stored procedure ).
    problem is how can i trap error which occured in procedure in my Oracle forms application.
    Tell me different methods to solve this problem
    I'am working in Oracle 8 and Forms 6i for windows NT 4.0
    Regards,
    Seema shah

    user21354 wrote:
    i am creating the collection in my Stored procedure it is giving me this error
    declare
    type t_number is table of number;
    v_numbers t_number;
    begin
    select VISIT_ID
    bulk collect into v_numbers
    from visit
    where VISITTYPEID = 2;
    select VISIT_ID from v_numbers;
    end;
    error
    PL/SQL: ORA-00942: table or view does not exist
    please tell me this why this happeningcouple of things...
    context switching - Your second 'select visit_id' query is actually parsed outside plsql, in the 'sql engine'. This sql engine has no knowledge of what v_numbers is, it's expecting an actual table name but it can't find anything called v_numbers in it's metadata. So it bombs out with that error. Google 'context switching plsql' for more info. :o)
    - as v_numbers is a collection, you could just loop through the results:
      for n in 1..v_numbers.count
      loop
        dbms_output.put_line(v_numbers(n));
      end loop;- as stated above, a 'select' without 'into' won't work in plsql anyway.
    - there is a way of getting round the context switch, by creating your Type in sql rather than plsql and 'casting' it to a table. Let us know if you want to know the steps to do it, but try reading up on context switch first.
    cheers.

Maybe you are looking for

  • Report generation, Excel isn't closed in the Task manager (LV2010)

    Hello everybody, I attached a simple example, to explain my problem. I tried (with Report generation) save data to Excel. That works fine. My problem is: in the Task Manager I can see the Excel.exe. Does anybody have a idea or a solution, why Excel d

  • I need to digital sign a document using Acrobat Reader. Is it possibile?

    I am an IT Manager for a little city in northern italy. I have almost 50 clients with smart cards enabled for what concerns digital signage. I use flawlessy the software of the firm who provides the smart card. (infocamere.it). This uses sha256 crypt

  • Trigger problem -- can't insert the same data into audit table

    Sir/Madam, I'm trying to use insert trigger with a 'long raw' datatype data for my audit purpose. Each time, the data of original table can be inserted correctly. While the trigger for audit table in which it contains almost the same data as original

  • Mapping handling in third party vs SAP PI for EDI 850

    Hi Experts, Can I know Pros and Cons for hanling mapping translations in third party vs handling mapping translations in SAP PI for EDI 850 interface. We are already paying money to third party. I just need pros and cons.. we will choose best approch

  • N93i bit of a problem can anyone help?

    well i perchased my phone from holiday in hong kong and have since been home and turned it on and phone calls work fine and i can recieve text messages but i cant send them i have been on the phone to orange and they have tryed to update my software