Home » SQL & PL/SQL » SQL & PL/SQL » Split string to form the INSERT
Split string to form the INSERT [message #208956] Tue, 12 December 2006 12:55 Go to next message
danielvm
Messages: 2
Registered: December 2006
Junior Member
I have to form my inserts from a string in one of my tables.

I have 3 tables
table Contract have 1 column DESCRIPTION whith string like this: T;20;AUX;GG

table Rule have 2 colums, ID and RuleString, like this:

id RuleString
T tam;tipo;forma
S tam;tipo;face

table Result whit 4 columns
tam tipo forma face


When I read the 1 line of Contract i have to parse the string and find the rule:

parse(T;20;AUX;GG) -> T. T is the right rule

the rule i have found was tam;tipo;forma

and the insert i need is formed from the rule, like this:

insert in rule(tam,tipo,forma) values '20','AUX','GG'

i need to do a proc that do it for me...

i am lost in the darkness, i cant split the string...

thanks
Re: Split string to form the INSERT [message #208967 is a reply to message #208956] Tue, 12 December 2006 15:04 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
http://www.orafaq.com/msgboard/plsql/messages/20508.htm
http://www.orafaq.com/msgboard/plsql/messages/19135.htm
http://fdegrelle.over-blog.com/article-1342263.html


If you can build your insert statement like "insert in rule values ('20','AUX','GG')" it will be easier.
else you need to loop through the column names and datatypes using user/all_tab_columns to determine them.
Re: Split string to form the INSERT [message #209028 is a reply to message #208956] Wed, 13 December 2006 00:32 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Whenever I read such requirements, I wonder who comes up with such monsters.
Is it a deliberate action to try to make it to http://thedailywtf.com ?
Were there no developers around that were sane enough just to refuse to build it?
Re: Split string to form the INSERT [message #209104 is a reply to message #209028] Wed, 13 December 2006 06:11 Go to previous message
danielvm
Messages: 2
Registered: December 2006
Junior Member
Thanks andrew,

you show me what i need...

i will make the code and then i will post the code here.


see you later!!!
Previous Topic: Hw to enable entry in USER_AUDIT_SESSION
Next Topic: about delete statement
Goto Forum:
  


Current Time: Tue Dec 06 15:58:08 CST 2016

Total time taken to generate the page: 0.16948 seconds