View previous topic :: View next topic
|
Author |
Message |
Dibyendu Mandal
New User
Joined: 08 Dec 2011 Posts: 10 Location: India
|
|
|
|
Hi,
I want to insert some hex value in a table.But the data type of the column is char.How can I do this.
Ex: I want to insert hex'3c00' in table,while the column datatype is char.
I am trying to insert atleast 100 rows.
Please help. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
would you consider,
looking at the manual,
learning about char datatype and what values a char column can contain.
how many bytes in the char datatype column?
spufi, qmf, db2 batch utility, imbedded sql? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Place this value in a host variable and use this for the insert.
If this is "real" data (as opposed to sme testing), hopefully, you are producing an audit trail so there are not "mysteries" in the data. Right ? |
|
Back to top |
|
|
Dibyendu Mandal
New User
Joined: 08 Dec 2011 Posts: 10 Location: India
|
|
|
|
Hi Dick,
I am not using any cobol or any other host language.My requirement is I need to insert around 500 rows with hex value for testing purpose.
its through SPUFI and my column is char datatype(char(20) for example). |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
guess what - any hex value is a valid char value. If necessary cut and paste the character(s). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Then embed the hex value in the values used for the INSERT.
As i mentioned before, this should NOT be done for real data (i.e. QA, PROD, etc). I have worked with organizations who terminate people for updating "real" data on the fly. . . fwiw.
You (or some incompetent above you) may believe this is acceptable, but is one of the most dangerous things that someone can do. Personally, i will not update data this way unless is is "my" data and then only if i've created a backup. We ALL do make mistakes and we need to get back to where we were. |
|
Back to top |
|
|
Dibyendu Mandal
New User
Joined: 08 Dec 2011 Posts: 10 Location: India
|
|
|
|
Hi Dick,
I understand that we should not use this in QA and prod.I am using the data for some negative testing.As soon as the testing is over we will backout the changes.
You told -"Then embed the hex value in the values used for the INSERT. "
How to do this.Normal insert like-
insert into employee
(empno,fname)
values(x'0030',dev);
is not working.Can you please provide me the structure of the query.[/img] |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
|