Shell和SQLPlus的交互问题2

#!/bin/sh
# 環境変数の指定
ORACLE_BASE=/oracle
export ORACLE_BASE

ORACLE_HOME=c:/oracle/ora92
export ORACLE_HOME

NLS_LANG=japanese_japan.JA16SJIS
export NLS_LANG

ORACLE_SID=${constr}
export ORACLE_SID

TNS_ADMIN=/oracle/product/9.2.0.3.0/network/admin
export TNS_ADMIN

PATH=/oracle/product/9.2.0.3.0/bin:$PATH
export PATH
password=axapi1111$
$ORACLE_HOME/bin/sqlplus -s axapi/[email protected] @test.sql 1
echo "aaa"$?
exit;

test.sql
define bb=&1
variable cc number
BEGIN
select count(1) into :cc from T_ML where AA = &bb;
END;
/
exit :cc;

注意:exit后只能跟0~255之间的数字,大于255的,对255取余返回

你可能感兴趣的:(oracle,sql,C++,c,C#)