03-22-2016
Convert Update statement into Insert statement in UNIX using awk, sed....
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 COL2 is NULL AND COL2=3;
OUTPUT Should be:
INSERT INTO TABLE_A (COL1,COL2,COL3) VALUES (1,NULL,3);
Many Thanks.
Last edited by dev123; 03-22-2016 at 12:07 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I sometimes bulk upload data in oracle. The problem is that I sometimes get an INSERT statemnt like this:
INSERT INTO ALL_USER_HOTSPOT_DETAILS (USR_LOGIN,USR_LASTNAME,USR_FIRSTNAME,USR_EMAIL,
PROPERTYNR)
VALUES ('SABRDAG','D'AGOS','SABRINA','sabrina_d'agos@sheraton.com',70)
I... (4 Replies)
Discussion started by: nattynatty
4 Replies
2. Shell Programming and Scripting
I have a file with a set of insert statements some of which have a single column value that crosses multiple lines causing the statement to fail in sql*plue. Can someone help me with a sed script to replace the new lines with chr(10)?
here is an example:
insert into mytable(id, field1, field2)... (3 Replies)
Discussion started by: jjordan
3 Replies
3. Shell Programming and Scripting
Hi all,
How can i use the below unix command in AWK . Can any one please suggest me how i can use.
sed -e "s/which first.sh/which \$0/g" $shell > $shell.sal
where $0=current program name(say current.sh)
$shell=second.sh (1 Reply)
Discussion started by: krishna_gnv
1 Replies
4. 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
5. Shell Programming and Scripting
Hi,
I have an array with characters and I am looking for specific character in that array and if those specific character not found than I use goto statment which is define somehwhere in the script. My code is:
set a = (A B C D E F)
@ i = 0
while ($i <= ${#a})
if ($a != "F" || $a != "D")... (3 Replies)
Discussion started by: dixits
3 Replies
6. Shell Programming and Scripting
Hi There,
I am trying to load data from a csv file into a DB during our DB migration phase. I am successfully able export all data into a .csv file but those have to rewritten in terms insert statement which will allow for further population of same data in different DB
My exiting csv record... (6 Replies)
Discussion started by: bhaskar_m
6 Replies
7. Shell Programming and Scripting
Hi,
Can we use 3 statements convert in a single statement.
First statement output using the second statement and the second statement output using the third statement please let me know the syntax so that I can able to merge all the three statement. (2 Replies)
Discussion started by: Priti2277
2 Replies
8. Shell Programming and Scripting
Hi,
Need help, using awk command to insert statement
awk -v q="'" '{ print "db2 connect to repolab > /dev/null; " "\n" "db2 -x \" select name from IBMPDQ.PROFILE where managed_database = " q $1"_"$3"__0" q "\"" } ' profile.txt | sh - | awk -v i="'" ' { print "db2 connect to repolab >... (1 Reply)
Discussion started by: Mathew_paul
1 Replies
9. Shell Programming and Scripting
input
| Jan 8 2018 11:28PM| 24 | 75 | 51 | 1 | 1.600|
| Jan 8 2018 12:01PM| 52 | 823 | 21 | 6 | 2.675|
desired output
Jan-8-2018-11:28PM 24 75 51 1 1.600
Jan-8-2018-12:01PM 52 823 21 6 2.675
Dear friends,
I have input file , as shown above and... (10 Replies)
Discussion started by: sagar_1986
10 Replies
10. Shell Programming and Scripting
Hello folks,
I have multiple occurrences of the pattern:
).:
where is any digit, in various text context but the pattern is unique as this regex. And I need to turn this decimal fraction into an integer (corresponding percent value: the range of 0-100).
What I'm doing is:
cat... (1 Reply)
Discussion started by: roussine
1 Replies
LEARN ABOUT DEBIAN
apgdiff
APGDIFF(1) APGDIFF(1)
NAME
apgdiff - Another PostgreSQL Diff Tool
SYNOPSIS
Usage: apgdiff [options] <old_dump> <new_dump>
DESCRIPTION
Another PostgreSQL Diff Tool is a simple PostgreSQL diff tool that is useful for schema upgrades. The tool compares two schema dump files
and creates an SQL output file that is (after some hand-made modifications) suitable for upgrades of old schemata.
OPTIONS
--version
displays apgdiff version
--add-defaults
adds DEFAULT ... in case new column has NOT NULL constraint but no default value (the default value is dropped later)
--add-transaction
adds START TRANSACTION and COMMIT TRANSACTION to the generated diff file
--ignore-function-whitespace
ignores multiple spaces and new lines when comparing content of functions
o WARNING: this may cause functions to appear to be same in cases they are not, so use this feature only if you know what you are
doing
--ignore-start-with
ignores START WITH modifications on SEQUENCEs (default is not to ignore these changes)
--in-charset-name <charset>
charset that should be used for reading input files (standard charset name supported by Java, default is UTF-8)
--out-charset-name <charset>
charset that should be used for writing output (standard charset name supported by Java, default is UTF-8)
--output-ignored-statements
outputs information about DDL statements that apgdiff ignores at this moment (it will not output any SELECT, INSERT, UPDATE and/or
DELETE statements)
--list-charsets
lists all supported charsets
AUTHOR
Miroslav ulc <miroslav.sulc@startnet.cz>. This manual page was written by Christoph Berg <myon@debian.org> for the Debian system (but may
be used by others).
10/31/2010 APGDIFF(1)