How-2-pass getdate() to oracle

  • How would I use getdate() in a sql query where the table is a oracle linked table? Thanks in advance for all your help.

    Mike

  • SYSDATE is the equivilent in oracle;

    SELECT SYSDATE FROM DUAL; for example.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I'm running the query from my ms sql server database where the linked server table is an Oracle table.

  • Thanks, it worked... How would I format the result to like like for example 20111219?

    My select stmt is as follows:

    Select SYSDATE

    , LCO

    , TMC

    From lnkOracle_Table

    Again, thanks for all your help...

    Mike

  • oracle has a suite of TO_* functions. TO_DATE and TO_CHAR for example, but i'm thinking this is going to be done on SQl, since you are really pulling the table into tempdb and then doing SLq stuff to it:

    --ora side

    SELECT TO_CHAR(SYSDATE,'YYMMDD')

    , LCO

    , TMC

    From lnkOracle_Table

    --sql side

    SELECTCONVERT(varchar,datecolumn,112)

    , LCO

    , TMC

    From lnkOracle_Table

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • That did the trick!!!! Again, thanks for all your great help.

    Mike

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply