Hello gurus,
I have data in one of the oracle tables as as below:
fyi, Column 2 above has data delimited with a comma as shown.
I need a sql query the produce the below output in two columns as.
Basically, I need to split data in one field based on a delimiter which is a comma and then normalize the data to get the required output. I have been trying sql using regex but without success. Any inputs are appreciated.
Thanks,
Carl
Moderator's Comments:
edit by bakunin: please use CODE-tags for data and file content too. Thank you.
This is basically what I want to do:
I have a file that contains single lines of IDs.
I want to query the oracle database using these IDs
to get a count of which ones match a certain condition.
the basic idea is:
cat myfile |
while read id
do
$id in select count(PC.ptcpnt_id)
from... (4 Replies)
Hi,
I have data in my text file something like this.
adams
robert
ahmed
gibbs
I want to use this data line by line as input to an sql query which i run by connecting to an oracle database from shell.
If you have code for similar scenario , please ehlp.
I want the output of the sql query... (7 Replies)
Hi ,
I used the below script to get the sql data into csv file using unix scripting.
I m getting the output into an output file but the output file is not displayed in a separe columns .
#!/bin/ksh
export FILE_PATH=/maav/home/xyz/abc/
rm $FILE_PATH/sample.csv
sqlplus -s... (2 Replies)
All,
Can anyone please help me with the below scenario.
I have a Flat file of the below format.
ID|Name|Level|Type|Zip|MAD|Risk|Band|Salesl|Dealer|CID|AType|CValue|LV|HV|DCode|TR|DU|NStartDate|UserRole|WFlag|EOption|PName|NActivationDate|Os|Orig|Cus|OType|ORequired|DType
03|... (10 Replies)
Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database.
I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :(
What should I do? I'm not sure that... (2 Replies)
Hi Gurus,
I have a request which needs to pass string into sql.
dummy code as below:
sqlplus -s user/password@instance << EOF >>output.txt
set echo off head off feed off pagesize 0 trimspool on linesize 1000 colsep ,
select emp_no, emp_name from emp
where emp_no in ('a', 'b', 'c');
exit;... (4 Replies)
I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email.
spool table_update.html;
SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription';
spool off;
exit;
Please use code tags next time for your code and data.... (9 Replies)
Current Situation:
1. Visit: https://xyz.com/2015/september?trackingparam=1234
2. The URL is missing the trailing / after the “september” directory
3. The URL is redirected and rewritten to: https://xyz.com/2015/september/ , dropping the query string data.
Note:... (0 Replies)
I want to run sql query in shell script and output data save as delimited text (delimited text would be comma)
Code:
SPOOL_FILE=/pgedw/dan.txt
SQL=/pgedw/dan.sql
sqlplus -s username/password@myhost:port/servicename <<EOF
set head on
set COLSEP ,
set linesize 32767
SET TRIMSPOOL ON
SET... (8 Replies)
Hi All,
Thanks for answering my previous question. Could you please explain the highlighted code?
awk -v pos='9 27 39 54 59 64 71 78 83 103 108' 'BEGIN{split(pos,var)} {for (i in var) $0=gensub(/./,"|",var)} 1' test.txt | head
I understood that the split function splits the pos string into... (2 Replies)
Discussion started by: mrcool4
2 Replies
LEARN ABOUT PHP
pdostatement.setfetchmode
PDOSTATEMENT.SETFETCHMODE(3) 1 PDOSTATEMENT.SETFETCHMODE(3)PDOStatement::setFetchMode - Set the default fetch mode for this statement
SYNOPSIS
public bool PDOStatement::setFetchMode (int $mode)
DESCRIPTION
bool PDOStatement::setFetchMode (int $PDO::FETCH_COLUMN, int $colno) bool PDOStatement::setFetchMode (int $PDO::FETCH_CLASS, string
$classname, array $ctorargs) bool PDOStatement::setFetchMode (int $PDO::FETCH_INTO, object $object)
PARAMETERS
o $mode
- The fetch mode must be one of the PDO::FETCH_* constants.
o $colno
- Column number.
o $classname
- Class name.
o $ctorargs
- Constructor arguments.
o $object
- Object.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Setting the fetch mode
The following example demonstrates how PDOStatement.setFetchMode(3) changes the default fetch mode for a PDOStatement object.
<?php
$sql = 'SELECT name, colour, calories FROM fruit';
try {
$stmt = $dbh->query($sql);
$result = $stmt->setFetchMode(PDO::FETCH_NUM);
while ($row = $stmt->fetch()) {
print $row[0] . " " . $row[1] . " " . $row[2] . "
";
}
}
catch (PDOException $e) {
print $e->getMessage();
}
?>
The above example will output:
apple red 150
banana yellow 250
orange orange 300
kiwi brown 75
lemon yellow 25
pear green 150
watermelon pink 90
PHP Documentation Group PDOSTATEMENT.SETFETCHMODE(3)