From: Dave Rose Date: 2007-05-05T04:57:08+09:00 Subject: Re: Witch Oracle library should I use Ben Edwards wrote: > On 04/05/07, Ulf Hellstr�m wrote: >> OTN (Oracle Technology Network) >> >> See the following links: >> >> http://www.oracle.com/technology/pub/articles/marx-ruby.html >> http://www.oracle.com/technology/pub/articles/tate-activeerecord.html >> http://www.oracle.com/technology/pub/articles/haefel-oracle-ruby.html >> http://www.oracle.com/technology/pub/articles/saternos-rails.html > > Thanks for this. Have been trying Ruby/OCI8 and it seems to work. > Only thing is when it fetches row it is referenced as an array > (row[0], row[1]...). Is there a way of referencing the column names > (row["username"]...). > > Ben i did a describe on my table that has a lot of column and cut & pasted the result (in order) into a ruby array and whose named ruby array.index(named column) address that certain corresponding column in the ruby oci8 array.... readcols="_CODE, V_NUM, CUST_CODE, STYP_CODE, CAT_CODE, ACTN_CODE, ACTION_DATE, ACTIVITY_DATE, USER_ID, READING, UMPTION, DOS, RTYP, REAS_CE, ARGE_DATE, UR_CALC_NUM, INVN_CODE, UIER, U_CADJM, U_FACTOR, UR_HIGH_LOW_EXCP, UR_TRBL_CODE_1, UR_TRBL_CODE_2, U_TRBL_CODE_3, AT_CODE, _CHARGE_FREQUENCY, U_CHARGE_START_DATE, UR_NUTS, UR_REAS_CODE_CNCL, US_CNCL_DATE, URR_CNCL_USER_ID, UR_CUST_CODE_PRIMARY, URRCODE_PRIMAR...and on and on....".split(", ") recs=conn.exec("SELECT * FROM atable WHERE CODE NOT IN ('IN','SKIP','OUT') AND CODE = '#{prem}' AND CUST_CODE = #{cust.to_i} AND TO_CHAR(GE_DATE,'YYYYMMDD') = '#{chargedon}' AND IS_DOS > 0"){|r| readrec<