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