home *** CD-ROM | disk | FTP | other *** search
- :
- #
- # $Header: oerr.sh,v 6.5 89/10/12 21:15:42 cyang Exp $ oerr.sh Copyr (c) 1988 Oracle
- #
-
- #
- # Usage: oerr facility error
- #
- # This shell script is used to get the description and the cause and action
- # of an error from a message text file when a list of error numbers are passed
- # to it. It supports different lauguage environments and errors from different
- # facilities.
- #
-
- if [ "$ORACLE_TRACE" = "T" ]; then
- set -x
- fi
-
- if [ ! "$1" ]; then
- echo Usage: $0 facility error
- exit 1
- fi
-
- #
- # If ORACLE_HOME is not set, we will not be able to locate
- # the message text file.
- #
- if [ ! "$ORACLE_HOME" ]; then
- echo "ORACLE_HOME not set!"
- echo "Please set ORACLE_HOME and try again."
- exit 1
- fi
-
- FAC=$1
- case $FAC in
- ora)
- PRODUCT=rdbms
- ;;
- dba)
- PRODUCT=rdbms
- ;;
- exp)
- PRODUCT=rdbms
- ;;
- imp)
- PRODUCT=rdbms
- ;;
- lcd)
- PRODUCT=rdbms
- ;;
- iac)
- PRODUCT=forms
- ;;
- iad)
- PRODUCT=forms
- ;;
- iap)
- PRODUCT=forms
- ;;
- iag)
- PRODUCT=forms
- ;;
- typ)
- PRODUCT=forms
- ;;
- srw)
- PRODUCT=sqlreport
- ;;
- *)
- echo $0: Unknown facility: $1
- exit 1
- ;;
- esac
-
- LANGUAGE=`echo $LANGUAGE | tr [A-Z] [a-z]`
- case $LANGUAGE in
- us*)
- LANG=us
- ;;
- german*)
- LANG=d
- ;;
- french*)
- LANG=f
- ;;
- spanish*)
- LANG=e
- ;;
- danish*)
- LANG=dk
- ;;
- italian*)
- LANG=i
- ;;
- norwegian*)
- LANG=n
- ;;
- dutch*)
- LANG=nl
- ;;
- swedish*)
- LANG=s
- ;;
- finnish*)
- LANG=sf
- ;;
- *)
- LANG=us
- ;;
- esac
-
- ERRFILE=$ORACLE_HOME/$PRODUCT/mesg/${FAC}${LANG}.msg
-
- if [ -r $ERRFILE ]
- then
- shift
- for ERR in $*
- do
- awk "BEGIN { FOUND=0; }
- /^[0]*$ERR/ { FOUND=1; print ; next;}
- /^\/\// { if (FOUND)
- {
- print
- next
- }
- else
- next;
- }
- { if (FOUND)
- exit;
- else
- next;
- } " $ERRFILE
-
- done
- else
- echo Cannot find $ERRFILE file.
- fi
-