Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Functions with date inputs

Re: Functions with date inputs

From: IANAL_VISTA <IANAL_Vista_at_hotmail.com>
Date: Sat, 13 Aug 2005 16:27:39 GMT
Message-ID: <Xns96B1603E02064SunnySD@68.6.19.6>


lisa.sloane_at_gmail.com wrote in
news:1123946628.750004.261390_at_g43g2000cwa.googlegroups.com:

> I am having a problem creating a function that accepts date input
> parameters. This is for my pl/sql class.
> I need to create a function called OLTP_NUMBER_SOLD to return number of
> car sales from OLTP Sales Table, given a starting and ending date as
> input parameters.
>
> this is what I have for my function:
> CREATE OR REPLACE FUNCTION OLTP_NUMBER_SOLD (p_start
> sales.sale_day%TYPE,
> p_end sales.sale_date%TYPE)
> RETURN NUMBER
> AS
> v_count NUMBER;
> BEGIN
> SELECT COUNT(*)
> INTO v_count
> FROM SALES
> RETURN v_count;
> END;
> /
> --FUNCTION CREATES SUCCESSFULLY
> --THEN CALL FUNCTION
> BEGIN
> DBMS_OUTPUT.PUT_LINE('NO. SOLD = '||OLTP_NUMBERR_SOLD(07-JUL-2005,
> 27-JUL-2005);
>
> --THEN I recieve error ORA-06650
> am I using the wrong date format to call the date? any assistance
> greatly appreciated..
> thanks
> Lisa
>
>

HUH?
ORA-06650?
I checked V8, V9, & V10 & could not find this error code.

What OS name & verion?
What version of Oracle DB to 4 decimal places?

You need to realize what you type are character strings; even if the contents appear to you to be a date they are NOT DATE datatypes. You'll need to use the TO_DATE function to transform your strings into actual date datatypes for Oracle. Received on Sat Aug 13 2005 - 11:27:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US