Hi,
I am creating a shell script to insert few records in db2 tables.
I am facing 2 challenges and would appreciate your help on this.
1) In my insert statement like follows:
db2 "connect to dbname user user_name";
db2 "insert into table_name (name, phone, ssn) values (${user_name},123456789,123456789)";
I am getting user_name from another file i am sourcing in this script.
The file has entry like this
The insert is failing because the "name" field in table is varchar and is expect
'XYZ' in insert statement and its getting XYZ without single quotes.
Appreciate help on this
2) I would like to break the insert statement into multiple lines for formatting.
I tried this
db2 "insert into table_name (name, phone, ssn) \n
values (${user_name},123456789,123456789)";
The insert fails on this as well.
Help is appreciated on above 2 issues.