Sponsored Content
Top Forums Shell Programming and Scripting how to Declare 5 values to one variable with OR operation Post 302522053 by ramsowji on Friday 13th of May 2011 07:26:02 AM
Old 05-13-2011
how to Declare 5 values to one variable with OR operation

what I'm trying to do is ... need to drop tables w/ names like
ABC_NY_2001
ABC_ORD_2001
ABC_TX_2001
ABC_CL_2001

For this, I want to write a query "DROP TABLE ABC_var_2001".
now "var" should be either NY, ORD, TX or CL.
I'm new to programming so don't know how to create a variable w/ OR operation means do i need to create array and assign these values to array ? .. if so can you guys pls help me how to solve this w/ example script.

Thanks in Advance!!!
RAM
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

declare number variable in csh

Hi frind, i="1" while do echo "i is $i" data_file=$HYP_ROOT/import/efcextr$i.txt echo "$data_file" i=`expr $i + 1` done This is woring finly in ksh but not in ksh. in ksh it showing error i=1: Command not found i: Undefined variable Kindly help me ...why it is showing the error... (1 Reply)
Discussion started by: deep_kol
1 Replies

2. Programming

declare a variable in mysql

i have created a script to insert 100K rows into mysql db. But the forst line where i declare the variable is giving error. I am new to mysql. Can anyone help me in this? the script is ====================================== DECLARE c INT(10) := 54; BEGIN WHILE c <... (4 Replies)
Discussion started by: amitranjansahu
4 Replies

3. Shell Programming and Scripting

Unable to declare a variable in Cygwin

I recently installed Cygwin on my windows vista to practice on Linux\unix commands. I am unable to do a simple task of declaring variables on the command prompt I am trying: $ vech=Bus $ echo $vech bash: vech : command not found What am I missing? Do i need to add something to .bashrc? ... (1 Reply)
Discussion started by: erora
1 Replies

4. UNIX for Dummies Questions & Answers

declare variable

hi to all, i am trying to declare a variable as an integer in unix shell script. i search the web for a way to do it but it doesnt work. i tried "define -i" and "declare" but that doesnt work. if somebody knows another way to declare a variable as integer please help me. thank you (2 Replies)
Discussion started by: omonoiatis9
2 Replies

5. Shell Programming and Scripting

How to declare a variable which can be accessed globally

Hi I've few shell scripts which are responsible for triggering the continuous builds for a specific module. Each shell script is for a Module. Shell script has some module specific settings in the beginning and then it triggers the builds (which are nothing but some combination of Java programs... (2 Replies)
Discussion started by: kgsrinivas
2 Replies

6. Shell Programming and Scripting

[CSH]legal to declare a variable like this

I am trying to declare a variable like this #!/bin/csh -f set c_arg = $a $b $c However, since i need it to declare before declaring $a ,$b or $c. As of now i am getting an error which says $a not defined. Is it possible to define a variable c_arg w/o interpreting the values $a $b $c (2 Replies)
Discussion started by: animesharma
2 Replies

7. Shell Programming and Scripting

how to declare variable in perl

how can i declare variable in perl. for BLOCK in /sys/block/emcpow* (3 Replies)
Discussion started by: learnbash
3 Replies

8. Shell Programming and Scripting

Arithmetic operation in variable

Hi, Here is the script i try to perform arithmetic operation in two variables . git branch -r | while read brname ; do REV_COMMITS=`git rev-list --count $brname` echo "$brname has $REV_COMMITS" (( TOTAL = TOTAL + REV_COMMITS )) echo "in loop" $TOTAL done echo "total is " $TOTAL ... (3 Replies)
Discussion started by: greet_sed
3 Replies

9. Shell Programming and Scripting

Do replace operation and awk to sum multiple columns if another column has duplicate values

Hi Experts, Please bear with me, i need help I am learning AWk and stuck up in one issue. First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique. Second point : For... (12 Replies)
Discussion started by: as7951
12 Replies

10. Shell Programming and Scripting

Declare and grep a variable via ssh/remote/loop

If I am running a bash command, and some awk getting the ethernet adapter on the local machine. It works fine. But if I will run it from the remote, it is EMPTY on echo and throwing error in grep. Thank you This work perfectly fine $ f=`/sbin/ip a|grep 127.127 | awk '{print $NF }' ` ; ip... (2 Replies)
Discussion started by: kenshinhimura
2 Replies
MYSQLI_STMT_ERROR_LIST(3)						 1						 MYSQLI_STMT_ERROR_LIST(3)

mysqli_stmt::$error_list - Returns a list of errors from the last statement executed

       Object oriented style

SYNOPSIS
array$mysqli_stmt->error_list () DESCRIPTION
Procedural style array mysqli_stmt_error_list (mysqli_stmt $stmt) Returns an array of errors for the most recently invoked statement function that can succeed or fail. PARAMETERS
o $ stmt -Procedural style only: A statement identifier returned by mysqli_stmt_init(3). RETURN VALUES
A list of errors, each as an associative array containing the errno, error, and sqlstate. EXAMPLES
Example #1 Object oriented style <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $mysqli->query("CREATE TABLE myCountry LIKE Country"); $mysqli->query("INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = $mysqli->prepare($query)) { /* drop table */ $mysqli->query("DROP TABLE myCountry"); /* execute query */ $stmt->execute(); echo "Error: "; print_r($stmt->error_list); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> Example #2 Procedural style <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } mysqli_query($link, "CREATE TABLE myCountry LIKE Country"); mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* drop table */ mysqli_query($link, "DROP TABLE myCountry"); /* execute query */ mysqli_stmt_execute($stmt); echo "Error: "; print_r(mysql_stmt_error_list($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> The above examples will output: Array ( [0] => Array ( [errno] => 1146 [sqlstate] => 42S02 [error] => Table 'world.myCountry' doesn't exist ) ) SEE ALSO
mysqli_stmt_error(3), mysqli_stmt_errno(3), mysqli_stmt_sqlstate(3). PHP Documentation Group MYSQLI_STMT_ERROR_LIST(3)
All times are GMT -4. The time now is 02:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy