# |>Description.<|
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
# 
# This file tests the Oratcl command oraplexec. It used the example
# wriiten by Tom Poindexter in the book Tcl/Tk Tools.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: plexec.test,v 1.4 1999/10/12 02:01:23 mtariq Exp $


source [file  join [pwd] [file dirname [info script]] defs.tcl]

set plsql_proc {
  create procedure total_monthly_job_pay
    (job_type in varchar2,
     tot_sal out number)
  as 
    tot_fixed NUMBER;
    tot_var number;
       
   begin
    select sum(sal) into tot_fixed
     from emp
     where job = job_type;
    select decode(sum(comm), NULL, 0, sum(comm)) into tot_var
     from emp
     where job = job_type;
   tot_sal := tot_fixed + tot_var;
   end;
}

set anon_pl {
   begin
    total_monthly_job_pay (:type, :total);
   end;
}

test oraplex {test of oratcl command oraplexec} {
    oralogon $oracleuser/$oraclepw@$connstring
    oraopen oratcl0.0
    oraplexec oratcl0.0 $plsql_proc
    oraplexec oratcl0.0 $anon_pl :type SALESMAN :total 0
} {SALESMAN 7800}

orasql oratcl0.0 "drop procedure total_monthly_job_pay"
oralogoff oratcl0 
::tcltest::cleanupTests

return


