David Mitchell wrote:
> I got an error on the following:
> 
>       case. SQL_TYPE_DATE;SQL_TYPE_TIME;SQL_TYPE_TIMESTAMP do.
>         if. 2 e.~ 3!:0 data do.
> 
> due to 'data' being undefined.
> 
> Possible fix:
> 
>       case. SQL_TYPE_DATE;SQL_TYPE_TIME;SQL_TYPE_TIMESTAMP do.
>         data=.>(of+i){x NB. DM 2006 07 24
>         if. 2 e.~ 3!:0 data do.
> 

Thanks David, that will be the fix.
For locale indpendent, it expects date format in odbc escape sequence:
          case. <'{d ' do. fm=. SQL_TYPE_DATE
          case. <'{t ' do. fm=. SQL_TYPE_TIME
          case. <'{ts' do. fm=. SQL_TYPE_TIMESTAMP
eg. {d '2006-07-24'}  note the single quotes and the space after the d,
in J syntax it is '{d ''2006-07-24''}'
the odbc driver will translate it to the format required by the dbms.

> A bit of documentation on ddins would be helpful also.  Perhaps:
> 
> NB. usage (sql;data1;data2;...) ddins ch
> NB. sql is a select statement
> NB. data1,data2,... are rank-2 vectors
> NB. eg. ch ddins~ 'select account,amount from
> chart';(>'apple';'orange';'cherry'); ,.100 300 200
> NB. limitation: null,unicode,long data type not support
> 
if date format included,
ch ddins~ 'select account,amount,indate from
chart';(>'apple';'orange';'cherry'); (,.100 300 200) ; (>'{d
''2006-07-24''}';'{d ''2006-07-25''}';'{d ''2006-07-26''}')

+---------------------------------------+------+---+----------------+
|select account,amount,indate from chart|apple |100|{d '2006-07-24'}|
|                                       |orange|300|{d '2006-07-25'}|
|                                       |cherry|200|{d '2006-07-26'}|
+---------------------------------------+------+---+----------------+

-- 
regards,
bill
-- 
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to