Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> REPOST: help: how to use bind value in date type?
i am learning how to use bind value. I have a test table with with
only two rows
Name Null? Type
------ -------- ------
COL1 NUMBER COL2 DATE
SQL> variable x number
SQL> begin
2 :x:=1;
3 end;
4 /
PL/SQL procedure successfully completed. SQL> select * from test where col1 = :x;
COL1 COL2
---------- ---------
1 24-JAN-02 1 row selected.
But I do not know how to use bind value with date type
SQL> variable x date
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n) | VARCHAR2(n) |
NCHAR | NCHAR (n) | NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR ] ]
SQL> variable x varchar2(60);
SQL> begin
2 :x:=to_date('2002/01/24 23:59:59','yyyy/mm/dd hh24:mi:ss');
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> select * from test where col2=:x;
no rows selected
but there are two rows in the table
SQL> select col1,to_char(col2,'yyyy/mm/dd hh24:mi:ss') from test;
COL1 TO_CHAR(COL2,'YYYY/
---------- ------------------- 1 2002/01/24 23:59:59 2 2002/01/25 23:59:59
2 rows selected.
What i did was wrong?
Thanks for you help
-- Sent by dbadba62 from hotmail subdomain of com This is a spam protected message. Please answer with reference header. Posted via http://www.usenet-replayer.com/cgi/content/new ========= WAS CANCELLED BY =======: From: u518615722_at_spawnkill.ip-mobilphone.net (Mike F) Control: cancel <l.1011974823.1024353027@[64.94.198.252]> Subject: cmsg cancel <l.1011974823.1024353027@[64.94.198.252]> Date: Sun, 27 Jan 2002 23:53:33 GMT Message-ID: <cancel.l.1011974823.1024353027@[64.94.198.252]> X-No-Archive: yes Newsgroups: microsoft.test,alt.flame.niggers,comp.databases.oracle.misc NNTP-Posting-Host: w088.z064003087.lax-ca.dsl.cnc.net 64.3.87.88 Lines: 1 Path: news.uni-stuttgart.de!news.fh-hannover.de!news-han1.dfn.de!news-kar1.dfn.de!news-fra1.dfn.de!newsfeed.hanau.net!fr.clara.net!heighliner.fr.clara.net!news-x2.support.nl!208.184.7.66.MISMATCH!newsfeed1.cidera.com!Cidera!novia!novia!news.stealth.net!msrtrans1!msrnewsc1!cppssbbsa01.microsoft.com!tkmsftngp01!tkmsftngp03!u&n&a&c&anceller Xref: news.uni-stuttgart.de control:40716343 This message was cancelled from within The Unacanceller's glorious new software, Lotus 1-2-3 For Rogue Cancellers.Received on Fri Jan 25 2002 - 10:07:02 CST
![]() |
![]() |