Hi,
I’m writing a KSH script that will read a table description output from a spool file, break down the datatype information, add a few columns and generate an XML file.
The part I’m stuck on is breaking down the datatype information returned.
In the spool file I have either NUMBER, NUMBER(9,2), VARCHAR2(30). I need to store each of the elements into separate variables.
Using the above info as an example I want NUMBER or VARCHAR2 stored in a variable called DATATYPE, the size 9 or 30 in a variable called SIZE and if there is a decimal 2, I want this stored in a variable called DEC.
I do not need the brackets and there will not always be a size and/or decimal for the number datatype.
Has anyone any ideas how I can break this out?? I’ve tried looking at awk and sed but only know basic stuff.
I’m writing a KSH script that will read a table description output from a spool file, break down the datatype information, add a few columns and generate an XML file.
The part I’m stuck on is breaking down the datatype information returned.
In the spool file I have either NUMBER, NUMBER(9,2), VARCHAR2(30). I need to store each of the elements into separate variables.
Using the above info as an example I want NUMBER or VARCHAR2 stored in a variable called DATATYPE, the size 9 or 30 in a variable called SIZE and if there is a decimal 2, I want this stored in a variable called DEC.
I do not need the brackets and there will not always be a size and/or decimal for the number datatype.
Has anyone any ideas how I can break this out?? I’ve tried looking at awk and sed but only know basic stuff.