c# - PL/SQL call doesn't return entire varchar2 return value -
i wrote procedure in pl/sql. @ end of procedure have this:
create or replace procedure lottery_titlebook(pout_count out varchar2) --get title-book. cursor s1 select * gilads.titlebook; rand float; randg varchar2(100); titlename varchar2(100); counter number(38); temp number(38); res_row s1%rowtype; begin counter := 0; temp:=0; --make random number generator: randg := to_char(systimestamp,'yyyyddmmhh24missffff'); dbms_random.seed (val => randg); --count how many title-book in cursor s1 open s1; loop fetch s1 res_row; exit when s1%notfound; counter := counter +1; end loop; close s1; --the random number 1 counter rand := dbms_random.value(low => 1, high => counter); --get titlebook.id determined random number: open s1; loop fetch s1 res_row; exit when s1%notfound; titlename := res_row.title; temp := temp + 1; if temp >= rand or temp = counter exit; end if; end loop; close s1; --print title book: pout_count:='the winner book is:' ||chr(13)||titlename; end;
when call c# "the winner boo". have problem functions.
this c# code:
using (oracleconnection con = new oracleconnection(connect)) { string temp; oraclecommand cmd = new oraclecommand(); cmd.connection = con; cmd.commandtext = "gilads.lottery_titlebook";//שם של פרוצדורה cmd.commandtype = commandtype.storedprocedure; cmd.parameters.add("pout_count", oracletype.varchar, 3200).direction = parameterdirection.output; try { con.open(); int test = cmd.executenonquery(); if (test == 1) textblock.text = cmd.parameters["pout_count"].value.tostring(); con.close(); } catch (exception ex) { messagebox.show(ex.message, "exception caught"); }
when set size of parameter 32000 nothing changes. idea wrong? maybe has oracle on localhost ant there setting need do? because in university code works properly
i noticed every time running function different length of string
Comments
Post a Comment