10-19-2010
Post the contents of your entire script over here.
Quote:
...For point (b), I want to check the table is exists in database or not, If it exists then only do for INSERT INTO statement, So i used if condition with select count(*) statement. ...
Do you have a reason to believe that someone/something will drop that table ?
If you do, then there's something seriously wrong with either your application or its security.
tyler_durden
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I am using Unix ksh script.
I need to insert values to a table using the o/p from a slelect statement.
Can anybody Help!
My script looks like tihs.
---`sqlplus -s username/password@SID << EOF
set heading off
set feedback off
set pages 0
insert into ${TB_NAME}_D... (2 Replies)
Discussion started by: nkosaraju
2 Replies
2. Shell Programming and Scripting
hi,
When i try to run the code below, i get the following error
"ksh: syntax error: `(' unexpected"
i am not able to figure it out. Can anyone help me?
Code: (2 Replies)
Discussion started by: ragavhere
2 Replies
3. Programming
I have a form , where i will put the values to a table.
I wrote a insert statement for the same.
Table structure is
ename | character varying(30) |
eadd | character varying(30) |
eid | integer |
sal | integer
In the statements, i don't... (1 Reply)
Discussion started by: pritish.sas
1 Replies
4. Shell Programming and Scripting
I am trying to assign an select statement into a variable. Can someone hel me with this.
example :
a='select * from dual'
echo $a should give me select * from dual
But this is not working. I trying with \ before * and quotes too. (1 Reply)
Discussion started by: rdhanek
1 Replies
5. Shell Programming and Scripting
Dear All,
we have a command output which looks like :
Total 200 queues in 30000 Kbytes
and we're going to get "200" and "30000" for further process. currently, i'm using :
numA=echo $OUTPUT | awk '{print $2}'
numB=echo $OUTPUT | awk '{print $5}'
my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies
6. Shell Programming and Scripting
Hi Guys,
I want to create a shell script that will give me the output below. I want to insert the numbers from the input file to my url addresses below. And from the numbers below, I want to separate the last digit with a period (i.e. from 222222222222 to 22222222222.2). Appreciate any help.... (14 Replies)
Discussion started by: pinpe
14 Replies
7. Shell Programming and Scripting
Hi Guys,
Can somebody help me in inserting today's DATE format (20110709) in my awk statement. I have a script but its not working.
inputfile.txt:
269,1,0,AAA,430
231,2,0,BBB,430
252,3,0,CCC,430
214,4,0,DDD,430
script.sh
#!/bin/bash
DATE="`date +%Y%m%d`"
cd /var/opt/ (8 Replies)
Discussion started by: pinpe
8 Replies
8. Shell Programming and Scripting
Hello,
I need to insert a space between 2 strings. I used many techniques and all of them worked but when I assign the value to another variable then the inserted space vanishes, strange! Please advise.
# dat=`date |awk '{print $2,$3}'`
# echo $dat
Nov 3
The above is perfectly fine. Now... (4 Replies)
Discussion started by: prvnrk
4 Replies
9. Shell Programming and Scripting
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
10. UNIX for Beginners Questions & Answers
I have the following script, and I want to assign the output ($10 and $5) from awk to N and L:
grdinfo data.grd | awk '{print $10,$5}'| read N L
output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies
LEARN ABOUT PHP
mysqli_stmt_bind_param
MYSQLI_STMT_BIND_PARAM(3) 1 MYSQLI_STMT_BIND_PARAM(3)
mysqli_stmt::bind_param - Binds variables to a prepared statement as parameters
Object oriented style
SYNOPSIS
bool mysqli_stmt::bind_param (string $types, mixed &$var1, [mixed &$...])
DESCRIPTION
Procedural style
bool mysqli_stmt_bind_param (mysqli_stmt $stmt, string $types, mixed &$var1, [mixed &$...])
Bind variables for the parameter markers in the SQL statement that was passed to mysqli_prepare(3).
Note
If data size of a variable exceeds max. allowed packet size (max_allowed_packet), you have to specify b in $types and use
mysqli_stmt_send_long_data(3) to send the data in packets.
Note
Care must be taken when using mysqli_stmt_bind_param(3) in conjunction with call_user_func_array(3). Note that
mysqli_stmt_bind_param(3) requires parameters to be passed by reference, whereas call_user_func_array(3) can accept as a parameter a
list of variables that can represent references or values.
PARAMETERS
o $
stmt -Procedural style only: A statement identifier returned by mysqli_stmt_init(3).
o $types
- A string that contains one or more characters which specify the types for the corresponding bind variables:
Type specification chars
+----------+---------------------------------------------------+
|Character | |
| | |
| | Description |
| | |
+----------+---------------------------------------------------+
| i | |
| | |
| | corresponding variable has type integer |
| | |
| d | |
| | |
| | corresponding variable has type double |
| | |
| s | |
| | |
| | corresponding variable has type string |
| | |
| b | |
| | |
| | corresponding variable is a blob and will be sent |
| | in packets |
| | |
+----------+---------------------------------------------------+
o $var1
- The number of variables and length of string $types must match the parameters in the statement.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Object oriented style
<?php
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'world');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
$stmt = $mysqli->prepare("INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)");
$stmt->bind_param('sssd', $code, $language, $official, $percent);
$code = 'DEU';
$language = 'Bavarian';
$official = "F";
$percent = 11.2;
/* execute prepared statement */
$stmt->execute();
printf("%d Row inserted.
", $stmt->affected_rows);
/* close statement and connection */
$stmt->close();
/* Clean up table CountryLanguage */
$mysqli->query("DELETE FROM CountryLanguage WHERE Language='Bavarian'");
printf("%d Row deleted.
", $mysqli->affected_rows);
/* close connection */
$mysqli->close();
?>
Example #2
Procedural style
<?php
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'world');
/* check connection */
if (!$link) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
$stmt = mysqli_prepare($link, "INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)");
mysqli_stmt_bind_param($stmt, 'sssd', $code, $language, $official, $percent);
$code = 'DEU';
$language = 'Bavarian';
$official = "F";
$percent = 11.2;
/* execute prepared statement */
mysqli_stmt_execute($stmt);
printf("%d Row inserted.
", mysqli_stmt_affected_rows($stmt));
/* close statement and connection */
mysqli_stmt_close($stmt);
/* Clean up table CountryLanguage */
mysqli_query($link, "DELETE FROM CountryLanguage WHERE Language='Bavarian'");
printf("%d Row deleted.
", mysqli_affected_rows($link));
/* close connection */
mysqli_close($link);
?>
The above examples will output:
1 Row inserted.
1 Row deleted.
SEE ALSO
mysqli_stmt_bind_result(3), mysqli_stmt_execute(3), mysqli_stmt_fetch(3), mysqli_prepare(3), mysqli_stmt_send_long_data(3),
mysqli_stmt_errno(3), mysqli_stmt_error(3).
PHP Documentation Group MYSQLI_STMT_BIND_PARAM(3)