Thank you for your response. When I run the one-liner, its doesnt apply the regex and produce the entire SQL statement like:
Its not honoring the regex:
So when it was working, it would simply find each line that had the SQL statement as in the above sample,inspect and include each newline until it reached the semicolon. The SQL statements in the PDF doc are not in a single line but broken down into multiple newlines, ending with a semicolon.
Moderator's Comments:
Please do wrap your samples/codes in CODE TAGS as per forum rules.
Last edited by RavinderSingh13; 02-02-2020 at 01:01 PM..
Hi,
Script that I wrote only run sql query once then exit. But my requirement, I want the query can be execute a couple of time without exiting the script. How could I do it? Thanks. (1 Reply)
Hi,
How to execute sql statements from the .sh file ??
Means, when we run .sh file then the sql statements within it should be get executed one by one from the sqlplus
With Regards (3 Replies)
Hi
Is there any way GREP command can return word and not complete line.
My file has following data:
Hello Everyone I am NitinrajSrivastava
Hi Friends Welcome VrajSrivastava
I am using grep 'raj' which is returning me complete line.However I want only the word having keyword 'raj'.
Required... (11 Replies)
Hi Guys..
need some urgent help... I am stuck in something badly
I need to write a script which would read a sql statement (which might be a join/inner join/select/sub select etc. )
I need to read that sql statement ... and in the output I want all the table names and columns (doesn't... (4 Replies)
I have a situation in which I'm given a bunch of pdf files which are all single pages with employee ID's on an independent line. I need to collate all of the pages by employee ID.
Piecemeal, I can find a particular employee ID by just using pdfgrep.
I could also do something like this: find .... (3 Replies)
Hi,
I have problem with the following code. My IF block is not executed. And I see "syntax error near unexpected token `)'" error for line "EOF" in the stats_function().
but when I comment the IF block I don't see this error.
Kindly help me with this issue.
clean_function()
{... (10 Replies)
The following is my script :
#!/bin/bash
echo "please give app_instance_id"
read app_instance_id
echo "id is $app_instance_id"
export app_id=app_instance_id
sqlplus -s nnviewer/lookup@//nasolora008.enterprisenet.org:1521/LOAD3 @test.sql<<EOF
SPOOL /home/tibco/MCH/Data/qa/raak/name.xls... (4 Replies)
hi, iam completely new to scripting. this may sound naive but i have spend lot of time figuring this out.
i want to make a script to find number of sql processes running. If the number of processes are more then 200, then pick out process IDs along with query it is executing, which are running... (0 Replies)
I am facing a problem while using the grep command in shell script. Actually I have one file (PCF_STARHUB_20130625_1) which contain below records.
SH_5.55916.00.00.100029_20130601_0001_NUC.csv.gz|438|3556691115
SH_5.55916.00.00.100029_20130601_0001_Summary.csv.gz|275|3919504621 ... (2 Replies)
Hi Gurus... good day;
currently I trying to run the df -g command with awk to get to convert in SQL statement, but I have some errors;
df -g | awk '{print "This is the FileSystem: " $NF, " This is LV: "$1, "This is SIZE: "$2, "This is FREE: " $3, "This is the USED% "$4}'
This on AIX... (3 Replies)
Discussion started by: wcastibl
3 Replies
LEARN ABOUT PHP
pdo.prepare
PDO.PREPARE(3) 1 PDO.PREPARE(3)PDO ::prepare - Prepares a statement for execution and returns a statement object
SYNOPSIS
public PDOStatement PDO::prepare (string $statement, [array $driver_options = array()])
DESCRIPTION
Prepares an SQL statement to be executed by the PDOStatement.execute(3) method. The SQL statement can contain zero or more named (:name)
or question mark (?) parameter markers for which real values will be substituted when the statement is executed. You cannot use both named
and question mark parameter markers within the same SQL statement; pick one or the other parameter style. Use these parameters to bind any
user-input, do not include the user-input directly in the query.
You must include a unique parameter marker for each value you wish to pass in to the statement when you call PDOStatement.execute(3). You
cannot use a named parameter marker of the same name more than once in a prepared statement, unless emulation mode is on.
Note
Parameter markers can represent a complete data literal only. Neither part of literal, nor keyword, nor identifier, nor whatever
arbitrary query part can be bound using parameters. For example, you cannot bind multiple values to a single parameter in the IN()
clause of an SQL statement.
Calling PDO.prepare(3) and PDOStatement.execute(3) for statements that will be issued multiple times with different parameter values opti-
mizes the performance of your application by allowing the driver to negotiate client and/or server side caching of the query plan and meta
information, and helps to prevent SQL injection attacks by eliminating the need to manually quote the parameters.
PDO will emulate prepared statements/bound parameters for drivers that do not natively support them, and can also rewrite named or ques-
tion mark style parameter markers to something more appropriate, if the driver supports one style but not the other.
PARAMETERS
o $statement
- This must be a valid SQL statement for the target database server.
o $driver_options
- This array holds one or more key=>value pairs to set attribute values for the PDOStatement object that this method returns. You
would most commonly use this to set the PDO::ATTR_CURSOR value to PDO::CURSOR_SCROLL to request a scrollable cursor. Some drivers
have driver specific options that may be set at prepare-time.
RETURN VALUES
If the database server successfully prepares the statement, PDO.prepare(3) returns a PDOStatement object. If the database server cannot
successfully prepare the statement, PDO.prepare(3) returns FALSE or emits PDOException (depending on error handling).
Note
Emulated prepared statements does not communicate with the database server so PDO.prepare(3) does not check the statement.
EXAMPLES
Example #1
Prepare an SQL statement with named parameters
<?php
/* Execute a prepared statement by passing an array of values */
$sql = 'SELECT name, colour, calories
FROM fruit
WHERE calories < :calories AND colour = :colour';
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':calories' => 150, ':colour' => 'red'));
$red = $sth->fetchAll();
$sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
$yellow = $sth->fetchAll();
?>
Example #2
Prepare an SQL statement with question mark parameters
<?php
/* Execute a prepared statement by passing an array of values */
$sth = $dbh->prepare('SELECT name, colour, calories
FROM fruit
WHERE calories < ? AND colour = ?');
$sth->execute(array(150, 'red'));
$red = $sth->fetchAll();
$sth->execute(array(175, 'yellow'));
$yellow = $sth->fetchAll();
?>
SEE ALSO PDO.exec(3), PDO.query(3), PDOStatement.execute(3).
PHP Documentation Group PDO.PREPARE(3)