Hi my UNIX Friends,
Im calling some SQL scripts through Unix Shell scripting.
How do I export the value of PL/SQL variable value into a Unix shell script variable?
Also could any one inform me about the 'search' and 'cut' utility of PL/SQL
(like 'grep' and 'cut' in Shell scripting).
... (10 Replies)
Hi Folks,
This is a small chunk of the bigger problem which i am facing and some help here will help me resolve the rest of the issue.
Problem is that i need to pass the value of a variable from a shell script to a SQL query (infact a lot of SQL's)
i have the following solution but somehow... (4 Replies)
hi I all ,
I have sql statment in my shell script , I pass two argument to the script I need to pass the this two arguments to the sql statment
example :
runsql.sh "1" "2"
sql :
updat tables_x set y=0
where
A=:x should subsituted by "1"
and
B=:y shuold subsituted bt "2"... (1 Reply)
Hi Gurus,
i have one requirement in unix script, i have a file called abc.txt in that few lines are there with the empid, i need to read each line and pass to .sql script.
ex:
abc.txt
2345
2346
1243
1234
i need to pass these arguments to .sql script rom unix
ex:
select * from... (1 Reply)
Hi Everyone,
Can anyone help me how do i call hash variable in to sql query in perl. Please see the script below
i have defined two Hash %lc and %tab as below
$lc{'REFF'}='V_RES_CLASS';
$lc{'CALE'}='V_CAP_CLASS';
$lc{'XRPD'}='V_XFMR_CLASS';
$tab{'V_RES_CLASS'}='V_MFR_SERS';... (6 Replies)
I have a requirement where i have a sql file (filetext.sql). This file contains a variable ss_code.
Now in a shell script im trying to replace the variable ss_code with a value contained in the shell script variable MTK_DC..tried the below in the script
MTK_DC="mit,cit,bit"
OUT=`awk -v... (4 Replies)
Here is the requirement, When I run the "run file KSH (sql)", it should substitute
'${pCW_Bgn_DT}' with 201120
and
'${pCW_End_DT}' with 201124
Input File
----------
$ cat prevwk.dat
201124 20110711
run file KSH (sql)
------------------
In this file, I want to use the variables... (1 Reply)
Hi Guys,
I am trying to pass a string variable from Unix shell script to sqlplus as a parameter.
I have tried using single quotes with the variable name but it does not work. Please help me with it.
I am using BASH.
My code:
Your help is much appreciated.
Thanks,
shil (2 Replies)
How to pass variable to sql file.
Im tryin in two ways,
Method 1:
my.sql
select * from table where col1 = '$1' and col2 = 'text';
Method 1execute: dbaccess database my.sql $var
Method2:
select * from table col1 in (`cat inputfile`) and col2 = 'text';
method... (2 Replies)
OS Solaris 10,
DB oracle 10g
Hello,
We currently have a BASH script that runs and moves image files from a remote server to the local db server. A snippet of the code shows that we are picking up all Images that are 'mtime -1'
some code...
for file in `ssh user@10.200.200.10 'find... (3 Replies)
Discussion started by: JonP
3 Replies
LEARN ABOUT REDHAT
cluster
CLUSTER(7) SQL Commands CLUSTER(7)NAME
CLUSTER - cluster a table according to an index
SYNOPSIS
CLUSTER indexname ON tablename
INPUTS
indexname
The name of an index.
table The name (possibly schema-qualified) of a table.
OUTPUTS
CLUSTER
The clustering was done successfully.
DESCRIPTION
CLUSTER instructs PostgreSQL to cluster the table specified by table based on the index specified by indexname. The index must already have
been defined on tablename.
When a table is clustered, it is physically reordered based on the index information. Clustering is a one-time operation: when the table is
subsequently updated, the changes are not clustered. That is, no attempt is made to store new or updated tuples according to their index
order. If one wishes, one can periodically re-cluster by issuing the command again.
NOTES
In cases where you are accessing single rows randomly within a table, the actual order of the data in the heap table is unimportant. How-
ever, if you tend to access some data more than others, and there is an index that groups them together, you will benefit from using CLUS-
TER.
Another place where CLUSTER is helpful is in cases where you use an index to pull out several rows from a table. If you are requesting a
range of indexed values from a table, or a single indexed value that has multiple rows that match, CLUSTER will help because once the index
identifies the heap page for the first row that matches, all other rows that match are probably already on the same heap page, saving disk
accesses and speeding up the query.
During the cluster operation, a temporary copy of the table is created that contains the table data in the index order. Temporary copies of
each index on the table are created as well. Therefore, you need free space on disk at least equal to the sum of the table size and the
index sizes.
CLUSTER preserves GRANT, inheritance, index, foreign key, and other ancillary information about the table.
Because the optimizer records statistics about the ordering of tables, it is advisable to run ANALYZE on the newly clustered table. Other-
wise, the optimizer may make poor choices of query plans.
There is another way to cluster data. The CLUSTER command reorders the original table using the ordering of the index you specify. This can
be slow on large tables because the rows are fetched from the heap in index order, and if the heap table is unordered, the entries are on
random pages, so there is one disk page retrieved for every row moved. (PostgreSQL has a cache, but the majority of a big table will not
fit in the cache.) The other way to cluster a table is to use
SELECT columnlist INTO TABLE newtable
FROM table ORDER BY columnlist
which uses the PostgreSQL sorting code in the ORDER BY clause to create the desired order; this is usually much faster than an index scan
for unordered data. You then drop the old table, use ALTER TABLE...RENAME to rename newtable to the old name, and recreate the table's
indexes. However, this approach does not preserve OIDs, constraints, foreign key relationships, granted privileges, and other ancillary
properties of the table --- all such items must be manually recreated.
USAGE
Cluster the employees relation on the basis of its ID attribute:
CLUSTER emp_ind ON emp;
COMPATIBILITY
SQL92
There is no CLUSTER statement in SQL92.
SQL - Language Statements 2002-11-22 CLUSTER(7)