Sponsored Content
Top Forums Shell Programming and Scripting How to use GOTO stmt in Unix scripting? Post 302680585 by RP09 on Thursday 2nd of August 2012 05:03:55 AM
Old 08-02-2012
How to use GOTO stmt in Unix scripting?

my code does somthing like this:
Code:
#!bin/ksh
sqlplus / | While read id
do
     temp[i]=`echo $id`
     i = i+1
done
j=0
while [ $j -le $i ]
do
     --connecting to sql and executing a Stored proc for 1st id
     --checking for the status 
     status = $?
     if [$status -ne 0]
          error
          --need to increment j and go to WHILE LOOP ------------How To GOTO while loop from this step and nees to execute Stored Proc for 2nd id and so onn
     else
          --some other steps need to be executed
done

please help!!.....


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by zaxxon; 08-02-2012 at 06:06 AM.. Reason: code tags, see PM
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unix version of gosub or goto??

Is there a Unix (Solaris v8 ksh) version of the old basic command gosub or goto? I've researched the return command, but can't identify the command to return from. I am not trying to return from a function. Can someone give me a basic understanding of this please? Thanks so much in advance for... (3 Replies)
Discussion started by: gozer13
3 Replies

2. UNIX for Dummies Questions & Answers

Please explain the stmt

hi, Please explain the below stmt. P=1234 var1=:/a/b/c/file.dat printf "%s %s\n" "$" "${var1#?}" Output is: 1234 /a/b/c/file.dat What is #? in printf stmt? by using that the first character( : ) of "var1" variable is not displayed in output. How is that? please explain.. ... (1 Reply)
Discussion started by: srilaxmi
1 Replies

3. Shell Programming and Scripting

Help with awk stmt

Hi All, I have a log file as: cat error.log.tmp1 2010-07-06 23:18:34 Connection Available to xyztestftp.abc.com.my 2010-07-06 23:20:33 Connection Available to xyztestftp.abc.com.my ERROR FTP LOGIN Now I am reading this complete log file if no single occurrence of word "ERROR" (this word... (5 Replies)
Discussion started by: ss_ss
5 Replies

4. Shell Programming and Scripting

I want to get the Unix variable value in the sql stmt

Hi All I have a requirement where in I am stuck. There is a shell script that is being developed by me. It consist of the sql stmt also. I need to export a variable called HOMEPAGE with a value say www.abc.com. and then use this $HOMEPAGE variable in the sql stmt. My ultimate aim is to fetch all... (1 Reply)
Discussion started by: amitsinha
1 Replies

5. Shell Programming and Scripting

Help with Dates and SQl stmt?

hi All Please explain the below statement in RED?What does this mean? perl /HDS/common/operations/Quality_Team/Nirvana/WEEKLY_OOPS/sql_dump.pl --sql "select * from WEEKLY_REPORT order by test_case, type" --username=ddb_qa --password=ddb_qa123 --sid=pldeldb --output... (1 Reply)
Discussion started by: SVS_2017
1 Replies

6. Shell Programming and Scripting

Case Stmt - Need Help Urgently

Hello All, Need help urgently.. i have a scenario where i have two files 1) mireport_20111406.txt 2) PRLIHSP01_8080.2011-06-11-15_26_31 ---------- I want a query something similar to this algorithm :- Case when file_name is like mireport then extract_date=14-06-2011 when... (4 Replies)
Discussion started by: iamnoone
4 Replies

7. Shell Programming and Scripting

"goto" like command in UNIX

Hi, echo "yes or no?" read ans case $ans in *) echo "yes" ;; *) echo "no" ;; *) echo "yes or no only" #here, if the answer is not "Y" or "N", I want to go back to asking "yes or no?" (9 Replies)
Discussion started by: erin00
9 Replies

8. Shell Programming and Scripting

Goto - UNIX v6 Manual Questions

Hey :) I am trying to understand the command goto. I have some questions regarding the goto manual. 1.What does the underlined part mean? I'm not allowed to type goto in the shell? But if goto is written into a file everything is okay? 2.So if a part of my file looks like this ... goto... (8 Replies)
Discussion started by: orbit
8 Replies

9. Shell Programming and Scripting

A dash to GOTO or a dash from GOTO, that is the question...

Well, guys I saw a question about GOTO for Python. So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too). Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'... This is purely a fun project to see if it is possible in PURE... (3 Replies)
Discussion started by: wisecracker
3 Replies
SQLSRV_HAS_ROWS(3)														SQLSRV_HAS_ROWS(3)

sqlsrv_has_rows - Indicates whether the specified statement has rows

SYNOPSIS
bool sqlsrv_has_rows (resource $stmt) DESCRIPTION
Indicates whether the specified statement has rows. PARAMETERS
o $stmt - A statement resource returned by sqlsrv_query(3) or sqlsrv_execute(3). RETURN VALUES
Returns TRUE if the specified statement has rows and FALSE if the statement does not have rows or if an error occurred. EXAMPLES
Example #1 sqlsrv_has_rows(3) example <?php $server = "serverNamesqlexpress"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" ) $conn = sqlsrv_connect( $server, $connectionInfo ); $stmt = sqlsrv_query( $conn, "SELECT * FROM Table_1"); if ($stmt) { $rows = sqlsrv_has_rows( $stmt ); if ($rows === true) echo "There are rows. <br />"; else echo "There are no rows. <br />"; } ?> SEE ALSO
sqlsrv_num_rows(3), sqlsrv_query(3). PHP Documentation Group SQLSRV_HAS_ROWS(3)
All times are GMT -4. The time now is 01:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy