Closed newsdy closed 7 years ago
fixed, c_src/MakeFile:
LINKFLAGS = -levent -lpthread -lerl_interface -lei -lerloci -locci -lclntsh -lnnz11
👍
hi @c-bik , i have a problem in my test
SelStmt = OciSession:prep_sql("select * from TEST where ID=2").
19> SelStmt:exec_stmt().
{cols,[{<<"ID">>,'SQLT_NUM',22,38,0},
{<<"TEST1">>,'SQLT_CHR',510,0,0},
{<<"TEST2">>,'SQLT_CHR',510,0,0}]}
20> SelStmt:fetch_rows(100).
{{rows,[[<<2,193,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>,
<<"4">>,<<"5">>]]},
true}
The db table TEST:
create table TEST
(
id INTEGER not null,
test1 VARCHAR2(255),
test2 VARCHAR2(255)
)
the result of ID is <<2,193,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>, why?
> oci_util:from_num(<<2,193,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>).
"2"
thank you very much! @c-bik , I have another question: the function :fetch_rows(Num) , when i select records from a table, but i do not know the number of records, so i cannot determine the value of the Num. Is there any other way to get all records ?
Num
in fetch_rows(Num)
is number of rows in single fetch. You can use any arbitrary big number to fetch all rows from your table or you can call fetch_rows(100)
multiple times (for example) to fetch 100 rows at a time until end-of-table.
i see, thanks for your help !
How to insert or update a NULL
value? @c-bik
I met a series of problems when the value is NULL
Try with an empty Erlang binary <<>>
(it is interpreted as Oracle DB NULL by this driver).
Which other null problems are you having?
@c-bik When the type is SQLT_CHR
, i can insert <<>> instead of NULL. If type is SQLT_TIMESTAMP
, SQLT_INT
or other, how to insert NULL?
<<>>
for NULL works for any type
thank you very much, I understand
hi, i used the rpms: oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
and the ~/.bash_profile in centos6.5 is
export INSTANT_CLIENT_LIB_PATH=/usr/lib/oracle/11.2/client64/lib/ export INSTANT_CLIENT_INCLUDE_PATH=/usr/include/oracle/11.2/client64/ export ERL_INTERFACE_DIR=/usr/local/lib/erlang/lib/erl_interface-3.7.20
when i exe rebar compile the error is that: /usr/bin/ld: cannot find -lons collect2: ld returned 1 exit status make: *\ [priv/ocierl] Error 1 ERROR: Command [compile] failed!
so, i found that libons.so isnot exist in /usr/lib/oracle/11.2/client64/lib/ Because the libs were changed in oracle12, but my db version is 11g. how to fix it? thx