Sponsored Content
Top Forums Programming How to pass table_name as variable Post 302365926 by mad_man12 on Wednesday 28th of October 2009 10:57:22 AM
Old 10-28-2009
How to pass table_name as variable

i need to delete the data from all the tables where a column appears
Eg column_name = ABCD
Now i do get all the tables where a column like ABCD appears and stores it
in another table say temp
There are around 800+ tables i get
so my temp table has two fields
table_name column_name
now i want to delete data from these tables based upon condition

so my query is
Now taking the table_name from temp table in a cursor

how do i pass the table_name dynamically or using as variable in a cursor
eg: delete from @table_name where some condition
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pass variable to sed?

Hi there. If variables are named inside of a ksh script, how is it possible to pass these to sed? The affected portion of my script goes something like this: A=`cut -d. -f1 $FILE` B=`cut -d. -f2 $FILE` C=`cut -d. -f3 $FILE` sed 's/1111/$A/g;s/2222/$B/g;s/3333/$C/g' file > anotherfile ... (2 Replies)
Discussion started by: kristy
2 Replies

2. UNIX for Dummies Questions & Answers

pass variable to awk

i would like to pass a variable to awk wherein the variable comes from external loop. i tried this... let x=0 until test $x -eq 32 do cat file | awk '{ print $1 , "Number" , $($x) }' >> output done thanks, (4 Replies)
Discussion started by: inquirer
4 Replies

3. UNIX for Dummies Questions & Answers

How do I pass a variable to awk?

I have an awk statement where I Need to pass an environment variable but I cannot get it to work: My evironment varible examples below: $FILE1=/dev/fs/file.new $FILE2=/dev/fs/file.old Code below: awk -F"|" ' BEGIN { while( getline < "$FILE1" ) { arr=1 } } arr != 1 { print } '... (12 Replies)
Discussion started by: eja
12 Replies

4. UNIX for Dummies Questions & Answers

How To Pass an Array Variable

Hi, I have a master BASH shell script where I define a bunch of variables: $var1=why $var2=is $var3=(this so hard) I would then like to call another shell script and pass these variables to it: $script2 $var1 $var2 $var3 This works fine for var1 and var2. However, var3 is an array,... (9 Replies)
Discussion started by: msb65
9 Replies

5. Shell Programming and Scripting

Pass variable to sql

Please help. I got these error. I'm try to pass variable extract from data-file.txt to sql file(select.sql). cat: cannot open select cat: cannot open * cat: cannot open from cat: cannot open user cat: cannot open where cat: cannot open name=$list; #!/bin/bash list=`sed q... (3 Replies)
Discussion started by: killboy
3 Replies

6. Shell Programming and Scripting

Problem with * when pass into variable.

Hello expert. I have a little problem here. I write a script and stuck some bug to fix. I found the problem was about * and a sample of script is below. line 1 is print * out but line 3 print all name of files in the script's path. (but I want *) I want to contain * in variable... (3 Replies)
Discussion started by: MaYuMi
3 Replies

7. Shell Programming and Scripting

How to pass a function with a variable parameter into another variable?

Hello again :) Am currently trying to write a function which will delete a record from a file. The code currently looks as such: function deleteRecord() { clear read -p "Please enter the ID of the record you wish to remove: " strID ... (2 Replies)
Discussion started by: U_C_Dispatj
2 Replies

8. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

9. Shell Programming and Scripting

How to pass variable to a query?

Hi All, How to pass date variable to a query? I have tried the below one , but it's not working. ost.ksh #!/bin/ksh v_date=$1 var=$(sqlplus -s $ORACON <<ENDOFSQL SELECT TO_DATE('$v_date','DD-MON-YYYY'),-1) FROM DUAL; exit; ENDOFSQL ) #End I have executed as below. (7 Replies)
Discussion started by: ROCK_PLSQL
7 Replies

10. UNIX for Beginners Questions & Answers

Need to pass variable in a command and assign value to a variable

Hello All, Hope you're doing well ! I am trying below command to be passed in a shell script, header_date_14 is a variable and $1 is the name of a file I intend to pass as a command line argument, however command line argument is not being accepted. header_date_14=$(m_dump... (8 Replies)
Discussion started by: ektubbe
8 Replies
SQLITE_FETCH_COLUMN_TYPES(3)											      SQLITE_FETCH_COLUMN_TYPES(3)

sqlite_fetch_column_types - Return an array of column types from a particular table

SYNOPSIS
array sqlite_fetch_column_types (string $table_name, resource $dbhandle, [int $result_type = SQLITE_ASSOC]) DESCRIPTION
Object oriented style (method): array SQLiteDatabase::fetchColumnTypes (string $table_name, [int $result_type = SQLITE_ASSOC]) sqlite_fetch_column_types(3) returns an array of column data types from the specified $table_name table. PARAMETERS
o $table_name - The table name to query. o $dbhandle - The SQLite Database resource; returned from sqlite_open(3) when used procedurally. This parameter is not required when using the object-oriented method. o $result_type - The optional $result_type parameter accepts a constant and determines how the returned array will be indexed. Using SQLITE_ASSOC will return only associative indices (named fields) while SQLITE_NUM will return only numerical indices (ordinal field numbers). SQLITE_ASSOC is the default for this function. RETURN VALUES
Returns an array of column data types; FALSE on error. The column names returned by SQLITE_ASSOC and SQLITE_BOTH will be case-folded according to the value of the sqlite.assoc_case configuration option. CHANGELOG
+--------+--------------------+ |Version | | | | | | | Description | | | | +--------+--------------------+ | 5.1.0 | | | | | | | Added $result_type | | | | +--------+--------------------+ EXAMPLES
Example #1 Procedural example <?php $db = sqlite_open('mysqlitedb'); sqlite_query($db, 'CREATE TABLE foo (bar varchar(10), arf text)'); $cols = sqlite_fetch_column_types('foo', $db, SQLITE_ASSOC); foreach ($cols as $column => $type) { echo "Column: $column Type: $type "; } ?> Example #2 Object-oriented example <?php $db = new SQLiteDatabase('mysqlitedb'); $db->query('CREATE TABLE foo (bar varchar(10), arf text)'); $cols = $db->fetchColumnTypes('foo', SQLITE_ASSOC); foreach ($cols as $column => $type) { echo "Column: $column Type: $type "; } ?> The above example will output: Column: bar Type: VARCHAR Column: arf Type: TEXT PHP Documentation Group SQLITE_FETCH_COLUMN_TYPES(3)
All times are GMT -4. The time now is 07:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy