Sponsored Content
Top Forums Shell Programming and Scripting How to put db2 query result into an array in shell script? Post 302461428 by hanul on Monday 11th of October 2010 07:19:08 AM
Old 10-11-2010
How to put db2 query result into an array in shell script?

Hello,

Can someone please advise me how to put the db2 query reult into an array?

For example, the query reults are:
string A
string B
string C

Then how do I put them into array[0]=string A
array[1]=string B
array[2]=string C

Thank you very much,
From a new learnner.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to store query multiple result in shell script variable(Array)

:) Suppose,I have one table A. Table A have one column. Table A have 10 rows. I want this 10 rows store into shell script variable. like #!/bin/ksh v_shell_var=Hi here in call oracle , through loop How can I store table A's 10 rows into v_shell_var (Shell Script Array). Regards, Div (4 Replies)
Discussion started by: div_Neev
4 Replies

2. Shell Programming and Scripting

read a file in shell and put result in a line

Hi All, I have a to read a file and put the result in one line. The i am reading from contain the data like below. 1 signifies the beging of the new line. (6 Replies)
Discussion started by: lottiem
6 Replies

3. Shell Programming and Scripting

pad db2 query result to 8 bits

Hi , I am using a db2 query to get the maximum sequence number from a field.Now this value is taking up only 2 places.(i.e its less than 100).It can grow up to 3 places later but me requirement is that when i write it in a text file, it should be padded upto 8 places. Please help (1 Reply)
Discussion started by: lifzgud
1 Replies

4. Shell Programming and Scripting

Db2 query with script

Hi All, I want to connect two tables in DB2 using shell script and then compare the contents of two tables field by field.and i should return on the screen the un matched records .. Could any one please help me in connecting database tables using Unix and retriving data from the same. (1 Reply)
Discussion started by: kanakaraju
1 Replies

5. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

6. Shell Programming and Scripting

Return db2 query value to shell script

Hi, Im new to DB2. I need to connect to DB2 from shell script and return the query output back to shell script variable. this is my code #!/bin/ksh db_name=db db_user=usr db_pwd=pwd db2 <<EOSQL connect to $db_name user $db_user using "$db_pwd" select count(1) from table quit EOSQL ... (3 Replies)
Discussion started by: sup
3 Replies

7. Shell Programming and Scripting

Problem in shell script db2 query for fetching and comparing records

hi.. my requirement is following: i want to have a shell script that queries a table i.e. fcm_auth in database fcmcore (I use db2) to get no of rows present for a given combination eg org and logo for past 5-10 mins interval. You can take some values of org(numerical values) and corresponding... (2 Replies)
Discussion started by: nishantrefound
2 Replies

8. Programming

Query result from shell script

Hi, I wrote the below script to get the query result from a Syabase DB. isql -s -U **** -P **** SYBASE SERVERNAME USE ***(Database name in Sybase) @command.sql But im not getting the output. Can anyone help me on this (2 Replies)
Discussion started by: rohan G
2 Replies

9. Shell Programming and Scripting

Taking information from a postgres sql query and putting it into a shell script array

I have a postgres sql statement that is the following: select age from students; which gives me the entries: Age --- 10 15 13 12 9 14 10 which is about 7 rows of data. Now what I would like to do with this is use a shell script to create an array age. As a results... (3 Replies)
Discussion started by: JSNY
3 Replies

10. UNIX for Beginners Questions & Answers

Putting query result dynamically to one cell of table from shell

I have to send a data in mail table format.only one cell need to get dynamically from query. my code is like (echo '<table boarder="1"> echo '<tr><td>stock</td><td>/path</td><td>.........</td></tr>' echo '</table> )sendmail.. in ......... I am trying to get query result.By putting query... (2 Replies)
Discussion started by: meera_123
2 Replies
MYSQLI(3)								 1								 MYSQLI(3)

The mysqli class

INTRODUCTION
Represents a connection between PHP and a MySQL database. CLASS SYNOPSIS
mysqli mysqli Properties o int$mysqli->affected_rows o string$mysqli->client_info o int$mysqli->client_version o int$mysqli->connect_errno o string$mysqli->connect_error o int$mysqli->errno o array$mysqli->error_list o string$mysqli->error o int$mysqli->field_count o int$mysqli->client_version o string$mysqli->host_info o string$mysqli->protocol_version o string$mysqli->server_info o int$mysqli->server_version o string$mysqli->info o mixed$mysqli->insert_id o string$mysqli->sqlstate o int$mysqli->thread_id o int$mysqli->warning_count Methods o mysqli::__construct ([string $host = ini_get("mysqli.default_host")], [string $username = ini_get("mysqli.default_user")], [string $passwd = ini_get("mysqli.default_pw")], [string $dbname = ""], [int $port = ini_get("mysqli.default_port")], [string $socket = ini_get("mysqli.default_socket")]) o bool mysqli::autocommit (bool $mode) o bool mysqli::change_user (string $user, string $password, string $database) o string mysqli::character_set_name (void ) o bool mysqli::close (void ) o bool mysqli::commit ([int $flags], [string $name]) o bool mysqli::debug (string $message) o bool mysqli::dump_debug_info (void ) o object mysqli::get_charset (void ) o string mysqli::get_client_info (void ) o bool mysqli::get_connection_stats (void ) o mysqli_warning mysqli::get_warnings (void ) o mysqli mysqli::init (void ) o bool mysqli::kill (int $processid) o bool mysqli::more_results (void ) o bool mysqli::multi_query (string $query) o bool mysqli::next_result (void ) o bool mysqli::options (int $option, mixed $value) o bool mysqli::ping (void ) o publicstatic int mysqli::poll (array &$read, array &$error, array &$reject, int $sec, [int $usec]) o mysqli_stmt mysqli::prepare (string $query) o mixed mysqli::query (string $query, [int $resultmode = MYSQLI_STORE_RESULT]) o bool mysqli::real_connect ([string $host], [string $username], [string $passwd], [string $dbname], [int $port], [string $socket], [int $flags]) o string mysqli::escape_string (string $escapestr) o bool mysqli::real_query (string $query) o public mysqli_result mysqli::reap_async_query (void ) o public bool mysqli::refresh (int $options) o bool mysqli::rollback ([int $flags], [string $name]) o int mysqli::rpl_query_type (string $query) o bool mysqli::select_db (string $dbname) o bool mysqli::send_query (string $query) o bool mysqli::set_charset (string $charset) o bool mysqli::set_local_infile_handler (mysqli $link, callable $read_func) o bool mysqli::ssl_set (string $key, string $cert, string $ca, string $capath, string $cipher) o string mysqli::stat (void ) o mysqli_stmt mysqli::stmt_init (void ) o mysqli_result mysqli::store_result ([int $option]) o mysqli_result mysqli::use_result (void ) PHP Documentation Group MYSQLI(3)
All times are GMT -4. The time now is 01:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy