I am trying to print a date in a select statement, but I need to add a letter to the output:
to_char(date_updated, 'YYYY-MM-DDTHH:mm:ss')
Oracle does not like the T. I just want the T to be output like the colons and the dashes. Can I escape it with a backslash or something?
...
I'd like to be able to return all columns in a table or in the resulting table of a join and still be able to transform a date to a string by name.
For example
Select ID, DESCRIPTION, TO_CHAR(CHANGE_DATE,'YYYY-MM-DD HH24:MI:SS') AS FORMATED_DATE FROM MY_TABLE;
This is all well and good for just these three columns. But, the table will...
I'm trying to display a DATE field fetched from a DB2 instance.
In Oracle I'd use something like:
to_char(v_date, 'YYYY-MM-DD')
What's the equivalent in AS400 DB2?
...
I am using SQLAlchemy to make database-independent querys.
I am facing one issue with to_char function.
Consider the simple query like:
select to_char(id,'999') from xyz
It's working on Postgres but MySQL doesn't support it.
How can I make this query database-independent using SQLAlchemy?
...
Hi,
I have a table containing a column of type Number
create table tmp (
/*other fields*/
some_field Number
)
and in a PL SQL script, I want to convert that field to a varchar. However, i don't know its length, so I get an exception
Exception message is ORA-06502:
PL/SQL: numeric or value error:
character string buffe...
Why does the following error occur on Line 7 of the query below?
Error: ORA-01861: literal does not match format string
Query:
01: SELECT hour
02: FROM (WITH all_hours AS
03: (SELECT TO_DATE ('2000-01-01', 'yyyy-mm-dd')
04: + NUMTODSINTERVAL (LEVEL - 1, 'hour') hour
05: FROM DUAL
06: ...
I have a query that joins two tables. One table has a column that is of type varchar, and the other table has type of number. I have executed my query on 3 oracle databases, and am seeing some strange results I hope can be explained. On two of the databases something like the following works.
select a.col1, b.somecol
from tableA a i...