Sponsored Content
Top Forums Shell Programming and Scripting sql select command output formatting in shell script Post 302563684 by rkrish on Wednesday 12th of October 2011 01:54:17 AM
Old 10-12-2011
Question sql select command output formatting in shell script

Hi,
I need to connect to the database and retrieve two variables from the database and store them in a variable,out of these two variables I need to get lastdigit appended to the variable 1 retrieved and variable 2 with out any modification
in short
select var,data from usage;
o/p= var1,5667456

required output should be :1,5667456Smilie
Anyone Please guide me in this Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

formatting the sql select result

Hi, I have about 12 columns and 15 rows to be retrived from sybase isql command through unix. But when i output the sql into a file and see it, the formatting is going for a toss. can someone please suggest how can i get the result correctly in the output file ? Thanks, Sateesh (2 Replies)
Discussion started by: kotasateesh
2 Replies

2. Shell Programming and Scripting

using SELECT sql statement in shell script

Hi there I have a database on a remote box and i have been using shell script to insert data into it for example, i could have a script that did this SN=123456 n=server1 m=x4140 sql="UPDATE main SET hostname='$n',model='$m' WHERE serial='$SN';" echo $sql |/usr/sfw/bin/mysql -h... (4 Replies)
Discussion started by: hcclnoodles
4 Replies

3. Shell Programming and Scripting

Unix shell command output to a sql statement

Can i do this Say one command sed 's/:*/ /g' $summf is returning C1234 C2345 C3434 some no of rows, now this ouput i have to insert it into a DB table how do i do this?? (2 Replies)
Discussion started by: depakjan
2 Replies

4. Shell Programming and Scripting

Formatting the query output using shell script

Hi All, I'm finding it difficult to format the query output that was returned in a shell script. Actually i have one shell script which does some DB stuff and depending on the result it will do some more tasks. My question here is to format the query output returned by mysql. Intitally my... (5 Replies)
Discussion started by: RSC1985
5 Replies

5. Shell Programming and Scripting

How to run a SQL select query in Oracle database through shell script?

I need to run a SQL select query in Oracle database and have to capture the list of retrieved records in shell script. Also i would like to modify the query for certain condition and need to fetch it again. How can i do this? Is there a way to have a persistent connection to oracle database... (9 Replies)
Discussion started by: vel4ever
9 Replies

6. Shell Programming and Scripting

How to use select into command in shell script?

I need to get total number of rows in a table by using select count(*) from table and need to assign into a variable in shell script. I used the following script, it does return the number of rows but also with oracle headers, Please help me to eliminate this headers. Shell Script #!/bin/sh... (16 Replies)
Discussion started by: vel4ever
16 Replies

7. Shell Programming and Scripting

Problem in formatting output of SQL query in excel sheet in shell script

Hi Guys.. Need your help to format the output of my shell script. I am using spool command to take out put in csv file. below is my code. (for example) col USERNAME for a15 col EMAIL for a30 col FULL_NAME for a20 col LAST_LOGIN for a40 col DATE_CREATED for a40 SPOOL 120.csv... (3 Replies)
Discussion started by: Agupte
3 Replies

8. Shell Programming and Scripting

Formatting Shell script output to Excel

I am facing a problem formatting the output of my shell script in excel. We are directing the output of the script to an excel sheet and need long integer type data printed in Excel as it is (i.e. not in the default scientific notation). Also, leading zeroes(if any) in the output are getting... (4 Replies)
Discussion started by: bornali.p
4 Replies

9. Shell Programming and Scripting

How to print the output of a select query using shell script?

HI, I want to connect to database and fetch the count from a table. The sql query is as below : select count(*) from table_test where test_column='read'; How can I print the output of this statement using shell script. Thanks in advance. (4 Replies)
Discussion started by: confused_info
4 Replies

10. Shell Programming and Scripting

SQL Query in Shell Script output formatting

Hi All, #!/bin/ksh call_sql () { sql=$1 sqlplus -s $sqlparam_sieb <<EOF SET ECHO OFF; SET NEWPAGE NONE; SET SQLBL OFF; SET VERIFY OFF; SET LINESIZE 2000; SET... (2 Replies)
Discussion started by: Kevin Tivoli
2 Replies
EvmVarGet(3)						     Library Functions Manual						      EvmVarGet(3)

NAME
EvmVarGet(), EvmVarGetOpaque(), EvmVarGetString(), EvmVarGetType(), EvmVarGetXxx(), EvmVarListFree(), EvmVarListGet(), EvmVarRelease(), EvmVarSet(), EvmVarSetOpaque(), EvmVarSetStringI18N(), EvmVarSetXxx() - manipulate event variables SYNOPSIS
Library EVM Support Library Parameters event The event to be processed. v_name The name of a variable in the event for which data is to be set or obtained. For if the named variable exists, the associated data is modified. If the variable does not exist, it is created and added to the event. The value to be stored is passed in item_value. type The enumeration constant for the type of the item_value to be stored in the variable indicated by v_name. Possible values for this field are: For the type operand is a returned value. item_value The value to be stored in the variable indicated by v_name. msg_id For a string variable being set in an internationalized event, msg_id may contain an I18N (internationalization) message iden- tifier corresponding to the value of the variable. The identifier must refer to a message in the catalog and message set asso- ciated with the event (see the EvmItemSet(3) manpage). The msg_id operand is ignored for variables whose type is not size The size of the associated item_value in bytes. The caller must specify the correct size when setting a variable of type For all other variable types, the size is ignored. var For the routine, this is a pointer to the location where the output data is to be stored. For the routine, this is a pointer to the storage space to be released. var_count This is the number of names in the var_list obtained by not including the terminating NULL pointer. varlist On return from the routine, this is a list of pointers to the names of the variables associated with the event. The last item in the list is a NULL pointer. For the routine, this is a list of names of variables for which memory should be freed. The list must be terminated by a NULL pointer. DESCRIPTION
The routine sets the value of a variable data item, indicated by v_name, in an event. This routine is used both for adding a variable and for altering its value. If the v_name variable is not already present in the event, it is added. The and routines offer a simpler means of setting a variable than the generic routine. Using these routines, a single call can set a vari- able of any type. To use these routines, replace the Xxx() in the routine name with the required type name, and supply a value of the cor- responding type as the item_value operand. The following types are supported: Boolean, Char, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64, Float, Double, String. Use to set a string variable with a non-zero I18N message-ID. Use to set an opaque variable. Each of these routines requires one more op- erand than the others in this group. The routine returns the event variable indicated by v_name in the var variable. The caller must free any space used by the variable by calling The routine returns the type of the named variable. The and routines offer a simpler means of retrieving a variable value than the generic routine. These routines can retrieve a variable of a specific type with a single call. To use these routines, replace the Xxx() in the routine name with the required type name, and supply a pointer to a location of the corresponding type as the item_value pointer. Refer to the description of above for details of the supported types. Use to retrieve a string variable, specifying NULL for the msg_id operand if you do not want to receive an I18N message-ID. Use to retrieve an opaque variable. Each of these routines requires one more operand than the others in this group. Note that and return their variable values in heap memory. Use to free this space when it is no longer needed. The routine releases any storage space allocated when the specified var was retrieved from an event using It is important that this routine is called when the variable is no longer needed to ensure that all memory associated with the variable is released. Do not use this rou- tine to release variables retrieved with any of the routines. The routine returns, in the varList reference argument, a pointer to an array of pointers to names of all the variables contained in the event. The last entry in the array is a NULL pointer. The var_count argument receives the number of names in the list, not counting the terminating null value. The caller must free the memory used by the list by calling The routine frees the memory used by a variable list (varList). Notes The caller must specify the size when adding an opaque variable to an event. To avoid memory leakage, memory that is supplied to the caller from API routines must be freed with the appropriate routine. RETURN VALUE
The operation completed without error. One of the arguments to the function is invalid. A value in a structure member is invalid. An operation failed because an attempt to acquire heap memory failed. A request specified an item or variable name component in an or a that is not part of the event being processed. ERRORS
The value of is not set. SEE ALSO
Event Management EVM(5). EVM Events EvmEvent(5) EvmVarGet(3)
All times are GMT -4. The time now is 10:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy