C# .NET - Oracle eiuvalent to SQL Server
Asked By Anwar Manha on 07-Nov-10 03:35 AM
what is the oracle equivalent to the below qurty
retval:=retval +' '+ CONVERT(VARCHAR(10),FLOOR(qty/ vunits));
when i run it in oracle it generate following error
no function with name varchar2 exist in this scope
oracle equivalent to sql server( Answer : Use Cast function instead of convert function)
Lalitha Kumaran replied to Anwar Manha on 07-Nov-10 04:00 AM
You can try with cast functionto to avoid the error:
retval:=retval+''+cast(floor(10.3/2) as varchar2(10));
Anwar Manha replied to Lalitha Kumaran on 07-Nov-10 05:39 AM
IT WORKED WITHOUT VARCHAR2 SIZE
but i had a similar query it generate an error
RETURN CAST(pInputDate, 111 AS VARCHAR2);
how to convert this to oracle
Mention value for pInputDate
Lalitha Kumaran replied to Anwar Manha on 07-Nov-10 06:10 AM
pInputDate ---------> ?.?.?.
Date format
Lalitha Kumaran replied to Anwar Manha on 07-Nov-10 06:27 AM
I Assume, you are trying to format the system date into YYYY/MM/DD format.Because,
system date gives you in this format (
"mm/dd/yyyy with current time" in oracle.
SELECT SYSDATE FROM DUAL (oracle) < ==>select getdate()(sql
server)
SELECT To_CHAR(SYSDATE,'YYYY/MM/DD') FROM DUAL(oracle) < ==>select convert(varchar,getdate(),111)(sql server)
Hope
this can solve ur problem