On 21 Sep., 16:30, beny 18241 <beny18... / gmail.com> wrote:
> which dont work as i wanted any idea how make such a script ?
let's create a table:
create table test (name varchar2(10),num number);
insert into test values ('elo',10);
commit;
NAME NUM
------------------------------ ----------
elo 10
let's create a function:
create or replace FUNCTION FUNCTION1(p_ID test.name% TYPE)
RETURN VARCHAR2 is result VARCHAR2(5);
BEGIN
SELECT name || num into result from Test where name = p_id;
RETURN result;
END FUNCTION1;
now use great ruby_plsql gem (by rsim)
require 'rubygems'
require 'ruby_plsql'
plsql.connection = OCI8.new("scott","tiger","emeadb11");
p plsql.function1('elo');
plsql.logoff
chris@chris-ub:~/staging/ruby$ ruby tmp1.rb
"elo10"
maybe that helps
chris