anjumr06 / squiggle-sql

Automatically exported from code.google.com/p/squiggle-sql
0 stars 0 forks source link

to_date function #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I need to create a sql statement as below

select * from <table>
where <column> = To_Date('2009-07-31','YYYY-MM-DD')

How do i do this ??

Original issue reported on code.google.com by madh...@gmail.com on 22 Jul 2010 at 9:11

GoogleCodeExporter commented 8 years ago
This will do the trick:

        Table table = new Table("table");
        Column c = new Column(table, "column");

        FunctionCall func = new FunctionCall("To_Date", 
                new StringLiteral("2009-07-31"),
                new StringLiteral("YYYY-MM-DD"));

        SelectQuery q = new SelectQuery();
        q.addToSelection(new WildCardColumn(table));

        q.addCriteria(new MatchCriteria(c, MatchCriteria.EQUALS, func));

By the way, this was not an "Issue". You would have better used the discussion 
group.

Original comment by brunoabdon on 6 Aug 2010 at 4:50