Search Postgresql Archives

Re: Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013-06-27 20:43, sachin kotwal wrote:
While migrating my application from DB2 to PostgreSQL.

I want to migrate TIMESTAMP() function of DB2 into PostgreSQL.

Example in DB2:
#SELECT TIMESTAMP('2013-01-01','12:13:14') FROM SYSIBM.SYSDUMMY1

1
--------------------------
2013-01-01-12.13.14.000000

   1 record(s) selected.
==========================

Example PostgreSQL:

#SELECT TIMESTAMP('2013-01-01','12:13:14');
ERROR:  syntax error at or near "'2013-01-01'" at character 18
STATEMENT:  SELECT TIMESTAMP('2013-01-01','12:13:14');
ERROR:  syntax error at or near "'2013-01-01'"
LINE 1: SELECT TIMESTAMP('2013-01-01','12:13:14');

After executing above SQL I am getting error.

I checked definition of TIMESTAMP().
It is as follows:
test=# \df timestamp
                                           List of functions
    Schema   |   Name    |      Result data type       |         Argument
data types          |  Type
------------+-----------+-----------------------------+--------------------------------------+--------
  pg_catalog | timestamp | timestamp without time zone | abstime
| normal
  pg_catalog | timestamp | timestamp without time zone | date
| normal
  pg_catalog | timestamp | timestamp without time zone | date, time without
time zone         | normal
  pg_catalog | timestamp | timestamp without time zone | timestamp without
time zone, integer | normal
  pg_catalog | timestamp | timestamp without time zone | timestamp with time
zone             | normal
(5 rows)

As we can see TIMESTAMP() hast two arguments date and time without time
stamp but still it is giving error to me.

Please reply if any suggestion.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/Migration-from-DB2-to-PostgreSQL-TIMESTAMP-arg1-arg1-tp5761389.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.



Hi,

# SELECT pg_catalog.timestamp('2013-01-01'::date, '12:13:14'::time);
      timestamp
---------------------
 2013-01-01 12:13:14
(1 row)





--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux