Sponsored Content
Full Discussion: Rolling back SQL transaction
Top Forums UNIX for Dummies Questions & Answers Rolling back SQL transaction Post 302663997 by sri_aue on Thursday 28th of June 2012 05:24:49 PM
Old 06-28-2012
Rolling back SQL transaction

Can some one help me related to .sql file issue.

I have a .sqlfile and tried to read the file thru unix. In the .sqlfile I have error rows as well and when error comes I dont want to proceed further and need to roll back all the transactions.

sample .sql file below


Code:
insert into
test values (9);
update test set id=9 where id=10;
updte test set id=3;
insert into
test values (1);
insert into test values (1);

I tried with "WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK" option also. Can some one help

Last edited by radoulov; 06-28-2012 at 06:37 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Rolling back time

Hi all, Have a small problem. Back in October the pervious sys-admin (of a client's company) made the necessary adjustments to the system clock for daylight savings (Sydney time - +11 GMT). As far as I can gather, they just amended the time - NO TIMEZONE !?! Is there an effective and safe... (5 Replies)
Discussion started by: Cameron
5 Replies

2. Shell Programming and Scripting

log rolling

Hi, I'm thinking of running a script via cron (every hour) to do the log rolling. The file is "file.txt" and there going to be 10 files rolling (file.txt.n). The file is being written constantly by an application. The script will do the following: 1. cat file.txt > file.txt.0 2. cat... (0 Replies)
Discussion started by: chaandana
0 Replies

3. Shell Programming and Scripting

Append transaction header lines to same transaction's detail lines

Hi guys, I was wondering if someone can give me a hand in helping me append transaction header line in a file at the end of the transaction detail lines. Basically, I have a file that looks like this: FHEAD File1 THEAD TRANS1-blah TDETL HI1 TDETL HI2 TDETL HI3 TTAIL TRANS1-blah THEAD... (3 Replies)
Discussion started by: rookie12
3 Replies

4. AIX

rolling back Technology Level

Hi, is it possible to roll back currently updated Technology level ? what are steps required? Regards, Manoj (2 Replies)
Discussion started by: manoj.solaris
2 Replies

5. Linux

Rolling Back an Update

I am writing a software product and hope that it will work on a variety of Linux distributions. At the moment, I am trying to create some kind of Linux version of patches/upgrades of installed software. Gathering information on available updates isn't hard, nor is installation of updates, but I... (27 Replies)
Discussion started by: Brandon9000
27 Replies

6. Shell Programming and Scripting

Sql command inside shell script runs without giving anything back as outout

#!/bin/sh # This script returns the number of rows updated from a function echo "The execution is starting ....." sqlplus -silent $UP <<EOF set serveroutput on set echo off set pagesize 0 VAR no_rows_updated NUMBER; EXEC :no_rows_updated :=0; DECLARE CURSOR c_update is SELECT * FROM... (4 Replies)
Discussion started by: LoneRanger
4 Replies

7. Shell Programming and Scripting

Need to pass Oracle SQL output to Linux and back... Help!

Hi all, Hopefully you can help. This is what I'm trying to achieve: Obtain a list of usernames out of an Oracle Database Based on this list, link each username with an Oracle Internet Directory (OID) GUID Using the username and GUID perform a database update for all users Here are the... (7 Replies)
Discussion started by: exm
7 Replies

8. UNIX for Dummies Questions & Answers

Middled Rolling average

Dear Help, The input file is below --- 13 2238422.00000 101083.00000 0.89024 0.00416 0.00467 14 2238318.00000 101090.00000 0.89100 0.00416 0.00467 15 2238209.00000 101100.00000 0.90964 0.00424 0.00466 16 2238104.00000 101104.00000 0.97568 0.00463 0.00475 17 2237991.00000 101113.00000... (8 Replies)
Discussion started by: Indra2011
8 Replies

9. Programming

Difference between BEGIN TRANSACTION & START TRANSACTION?

What's the difference between BEGIN TRANSACTION vs START TRANSACTION? Also goes for COMMIT TRANSACTION vs COMMIT? (0 Replies)
Discussion started by: dan139
0 Replies
ABORT(7)							   SQL Commands 							  ABORT(7)

NAME
ABORT - abort the current transaction SYNOPSIS
ABORT [ WORK | TRANSACTION ] DESCRIPTION
ABORT rolls back the current transaction and causes all the updates made by the transaction to be discarded. This command is identical in behavior to the standard SQL command ROLLBACK [rollback(7)], and is present only for historical reasons. PARAMETERS
WORK TRANSACTION Optional key words. They have no effect. NOTES
Use COMMIT [commit(7)] to successfully terminate a transaction. Issuing ABORT when not inside a transaction does no harm, but it will provoke a warning message. EXAMPLES
To abort all changes: ABORT; COMPATIBILITY
This command is a PostgreSQL extension present for historical reasons. ROLLBACK is the equivalent standard SQL command. SEE ALSO
BEGIN [begin(7)], COMMIT [commit(7)], ROLLBACK [rollback(7)] SQL - Language Statements 2010-05-14 ABORT(7)
All times are GMT -4. The time now is 10:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy