| | |
tranfer of data within tables
Please support our Oracle advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
i ve 1 table named 'A',it contains many attributes in 1 attribute the values are stored like this "Q108:5380;Q208:5380" this data present in table 'A' should be entered in table named 'B' in two fields named B1,B2 as
B1 B2
Q108 5380
Q208 5380
like this in two columns this data should be entered in table named 'B' from table 'A'. here : means separates two columns and ; means separates two rows.
please help me or tell me how to write this in code. i am using oracle database. thank you
B1 B2
Q108 5380
Q208 5380
like this in two columns this data should be entered in table named 'B' from table 'A'. here : means separates two columns and ; means separates two rows.
please help me or tell me how to write this in code. i am using oracle database. thank you
here is some pl/sql code that gives you an idea I hope that would help
Oracle Syntax (Toggle Plain Text)
DECLARE a1 VARCHAR2(255); b1 VARCHAR2(255); a2 VARCHAR2(255); b2 VARCHAR2(255); qry VARCHAR2(4000); CURSOR cr_a IS (SELECT * FROM a); BEGIN --loop goes to every row in a FOR rc_a IN cr_a LOOP --seperates column of A table to for variable --you have to write it it is simple string operations seperatecolumn(rc_a.COLUMN , a1,a2,b1,b2); qry := 'insert into b (B1,B2) values (' || a1 || ',' || a2 || ')'; --run query EXECUTE IMMEDIATE qry; qry := 'insert into b (B1,B2) values (' || b1 || ',' || b2 || ')'; EXECUTE IMMEDIATE qry; END LOOP; END;
![]() |
Other Threads in the Oracle Forum
- Previous Thread: Cloud computing
- Next Thread: Update using join
| Thread Tools | Search this Thread |
Tag cloud for Oracle
2009predictions acquisition amazon.com bartz bernanke cia citrix cloudcomputing crm database dell economy editor enterprise enterprise2.0 enterprisesoftware erp federalreserve forbes hp ibm intellipedia internet larryellison layoffs linux loughridge mediawiki michaeljackson microsoft neverland nortel notebooks oil operatingsystem oracle palm rimm saas salesforce sap seagate socialcomputing sql sun sybase technologystocks virtualiron virtualization vmware wiki wikipedia xen yahoo zoho





