I have an output parameter in oracle called outTime of type DATE. The format for this is set as yyyy-mm-dd and I need to be able to include the time from a table when I select into it.
I keep getting an error : date format picture ends before converting entire input string.
here is the insert into statement.
SELECT TO_CHAR(Table_Time, 'YYYY-MM-DD HH24:MI:SS') into outTime
FROM Table_One;
the out parameter is declared as
outTime OUT DATE;
within a stored procedure in a package of other procedures.
I keep finding ways to set the format globally but I only need to set the format for this instance.
Thanks for any insight.
A
DATEdoes not have a format. A string representation of a date has a format but aDATEdoes not.If
Table_Timeis aVARCHAR2(a string representation of a date) in the formatyyyy-mm-dd hh24:mi:ss, then you would want to useTO_DATEto convert the string into aDATE(I assume that there is a single row intable_onein this example, otherwise theSELECT ... INTOwill raise ano_data_foundor atoo_many_rowsexception.If
Table_Timeis aDATE, you would simply assign it tooutTimeWhen you want to display
outTime, you’ll need to convert theDATEto a string representation of a date (aVARCHAR2). At that point, you can use theTO_CHARfunction.