Sponsored Content
Full Discussion: Formating error message
Top Forums UNIX for Advanced & Expert Users Formating error message Post 302112296 by ganapati on Tuesday 27th of March 2007 07:37:24 AM
Old 03-27-2007
Java Formating error message

Hi Unix Punters,

Iam calling one PL/SQL script 'a.sql' through a shell script 'a.sh' and capturing
the error message generated during execution of a.sql and storing this message in one log file 'a.log'.

a.sh:-

#!/usr/bin/ksh

RESULT=`sqlplus -s username/password@database <<!
@a.sql
!`
echo $RESULT >> a.log



a.sql:-

Set serveroutput on
WHENEVER SQLERROR EXIT 1
WHENEVER OSERROR EXIT 2

BEGIN
insert into aaa (sal) (select name from bbb);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('Errored while inserting to the table aaa');
RAISE;
END;
/
EXIT SUCCESS


The scripts 'a.sh' and 'a.sql' are present in the below location.

/export/home/ITC_rlok>ls -lrt
total 16
drwxrwxrwx 4 ITC_rlok ITC 512 Dec 7 05:09 CR11
drwxrwxrwx 10 ITC_rlok ITC 512 Dec 22 14:21 RMIS
drwxrwxrwx 7 ITC_rlok ITC 512 Feb 6 13:18 TEMP
drwxrwxrwx 5 ITC_rlok ITC 512 Feb 8 08:32 CRED0001
drwxrwxrwx 2 ITC_rlok ITC 512 Mar 13 09:51 TEST
drwxrwxrwx 3 ITC_rlok ITC 512 Mar 27 11:27 SLLD0005
-rwxrwxrwx 1 ITC_rlok ITC 271 Mar 27 12:13 a.sql
-rwxrwxrwx 1 ITC_rlok ITC 90 Mar 27 12:17 a.sh

Now Iam executing the program 'a.sh'.

/export/home/ITC_rlok>a.sh
Errored while inserting to the table aaa BEGIN a.sh a.sql CR11 CRED0001 RMIS SLLD0005 TEMP TEST ERROR at line 1: ORA-01722: invalid number ORA-06512: at line 6

Iam getting the required error message. The problem here is, the error message is also containing other file/directory name which are present along with 'a.sh'.
I dont want to display the file/directory names along with error message. Please help me to avoid this problem.

I need only the error message as per below order:

Errored while inserting to the table aaa
ERROR at line 1: ORA-01722: invalid number
ORA-06512: at line 6


Thanks in advance,
Mysore Ganapati.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Error message

I'm getting an error - symbol referencing errors. No output written to, etc Can anybody tell me why this is? (2 Replies)
Discussion started by: Dan Rooney
2 Replies

2. Solaris

lp error message

Both of these messages are filling up the /var/adm/messages files on these two Sun boxes, goober and gomer. The print server is called gold. Jul 31 03:15:40 gold bsd-gw: request to ma28084.Solaris (unknown printer) from goober Jul 31 03:16:39 gold bsd-gw: request to ma28084.Solaris (unknown... (1 Reply)
Discussion started by: antalexi
1 Replies

3. AIX

Error Message with ls

When I try to list a directory that I have been using rsync to copy, I now am getting the following message. root # ls -alt /directory ls: /directory: Value too large to be stored in data type. total 0 I can change directory and list the contents of directories within /directory, but I... (2 Replies)
Discussion started by: sallender
2 Replies

4. UNIX for Advanced & Expert Users

error message

I get this error message as soon as i log in -bash: /usr/local/software/.../vni/CTT6.0/ctt/bin/lopt64.sh: No such file or directory I looked into the etc/profile but there are no lines sourcing this file. And there is no lopt64.sh in the directory vni/.../bin I couldn't fogure out what... (4 Replies)
Discussion started by: dsmv
4 Replies

5. Shell Programming and Scripting

Error message

I am new to scripting. I am using the following script . BART.dat contains the string 'Y' . #!/bin/ksh cd /work/TCI/data_out file=`cat BART.dat` echo "$file" if ; then echo "true" fi When i am executing the above script i am getting the following error ./s.ksh: : not found ... (2 Replies)
Discussion started by: ammu
2 Replies

6. UNIX for Dummies Questions & Answers

Error Message

I keep getting an error message in a script im writing, this line is allways pointed out. if and this is the message i keep getting. line 32: [: 8: unary operator expected Whats wrong with it? Please Help. (5 Replies)
Discussion started by: chapmana
5 Replies

7. UNIX for Dummies Questions & Answers

What does this error message mean?

I was reviewing logs and I got this error message in /var/log/messages: Did not receive identification string from (IP ADDRESS) What does it mean? (6 Replies)
Discussion started by: mojoman
6 Replies

8. UNIX for Dummies Questions & Answers

What does this Error Message Mean

Hi I found the following error message in my logs: warning: /etc/hosts.deny, line 6: can't verify hostname: getaddrinfo(localhost) didn't return ::ffff:222.255.28.33 What is the error message trying to indicate? That there is a problem with line 6 (2 Replies)
Discussion started by: mojoman
2 Replies

9. Red Hat

formating a USB which is throwing error write delayed

Hello, while i was saving a web file directing on to usb location there was some network problem which result in error WRITE DELAYED on windows xp. so pen drive is not getting completely formated(show as Windows was unable to complete format).From then onwords it is not allowing to copy... (0 Replies)
Discussion started by: amarnathbasis8
0 Replies
SQLSRV_ERRORS(3)														  SQLSRV_ERRORS(3)

sqlsrv_errors - Returns error and warning information about the last SQLSRV operation performed

SYNOPSIS
mixed sqlsrv_errors ([int $errorsOrWarnings]) DESCRIPTION
Returns error and warning information about the last SQLSRV operation performed. PARAMETERS
o $errorsOrWarnings - Determines whether error information, warning information, or both are returned. If this parameter is not supplied, both error information and warning information are returned. The following are the supported values for this parameter: SQLSRV_ERR_ALL, SQL- SRV_ERR_ERRORS, SQLSRV_ERR_WARNINGS. RETURN VALUES
If errors and/or warnings occurred on the last sqlsrv operation, an array of arrays containing error information is returned. If no errors and/or warnings occurred on the last sqlsrv operation, NULL is returned. The following table describes the structure of the returned arrays: Array returned by sqlsrv_errors +---------+---------------------------------------------------+ | Key | | | | | | | Description | | | | +---------+---------------------------------------------------+ |SQLSTATE | | | | | | | For errors that originate from the ODBC driver, | | | the SQLSTATE returned by ODBC. For errors that | | | originate from the Microsoft Drivers for PHP for | | | SQL Server, a SQLSTATE of IMSSP. For warnings | | | that originate from the Microsoft Drivers for PHP | | | for SQL Server, a SQLSTATE of 01SSP. | | | | | code | | | | | | | For errors that originate from SQL Server, the | | | native SQL Server error code. For errors that | | | originate from the ODBC driver, the error code | | | returned by ODBC. For errors that originate from | | | the Microsoft Drivers for PHP for SQL Server, the | | | Microsoft Drivers for PHP for SQL Server error | | | code. | | | | |message | | | | | | | A description of the error. | | | | +---------+---------------------------------------------------+ EXAMPLES
Example #1 functionname(3) example <?php $serverName = "serverName/sqlexpress"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { die( print_r( sqlsrv_errors(), true)); } /* Set up a query to select an invalid column name. */ $sql = "SELECT BadColumnName FROM Table_1"; /* Execution of the query will fail because of the bad column name. */ $stmt = sqlsrv_query( $conn, $sql ); if( $stmt === false ) { if( ($errors = sqlsrv_errors() ) != null) { foreach( $errors as $error ) { echo "SQLSTATE: ".$error[ 'SQLSTATE']."<br />"; echo "code: ".$error[ 'code']."<br />"; echo "message: ".$error[ 'message']."<br />"; } } } ?> NOTES
By default, warnings generated on a call to any SQLSRV function are treated as errors. This means that if a warning occurs on a call to a SQLSRV function, the function returns FALSE. However, warnings that correspond to SQLSTATE values 01000, 01001, 01003, and 01S02 are never treated as errors. For information about changing this behavior, see sqlsrv_configure(3) and the WarningsReturnAsErrors setting. SEE ALSO
sqlsrv_configure(3). PHP Documentation Group SQLSRV_ERRORS(3)
All times are GMT -4. The time now is 07:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy