473,472 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

fetching rows one by one and inserting rows in another table to cursor

1 New Member
Hi,

I have two tables. The first table T1 contains columns StartChequeNo, AccountNo and ChequeBookSize. Values are StartChequeNo - 65551, AccountNo - 2321, ChequeBookSize - 10 like wise there are 100 rows for 100 different accounts. I have to insert the same data in another table T2 irrespective of the ChequeBookSize ie., If the ChequeBookSize is 10 in table T1 then I have to insert rows to T2 table 10 times with different cheques series like:
TABLE T2:
StartChequeNo AccountNo
65551 2321
65552 2321
65553 2321...
and the same loop will goes till the nof of times equal to the cheque book size i.e., is 10 times and also the cheque book size are different for every account.

Any help toward this is appreciated that how to make this possible in form of cursor in Oracle.
May 3 '14 #1
1 1441
Luuk
1,047 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO T2 (ChequeNo, AccountNo) 
  2. SELECT StartChequeNo+ROWNUM-1,  AccountNo  FROM T1;
  3.  
May 4 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: simon | last post by:
Hi, I have two tables Table A = {ID, Item} Table B = {ID, IDA, subItem} Where ID auto increment. INSERT INTO TABLE_A ('items') values ('a')
11
by: grumfish | last post by:
I'm trying to add a row to a MySQL table using insert. Here is the code: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor()...
0
by: Chris N | last post by:
I have 2 tables Stores and Store_Projects that im trying to pull all stores not in certian projects but belong to a customer. Heres the design of each CREATE TABLE `Stores` ( `storeID` int(10)...
7
by: rcamarda | last post by:
I wish to build a table based on values from another table. I need to populate a table between two dates from another table. Using the START_DT and END_DT, create records between those dates. I...
0
by: craftit | last post by:
hi everyone, i need to insert multiple rows in a single table using Oledbdataadapter for access database all in one trip in my winform(VB.Net). i've tried the best i can.Can anyone please help me...
2
by: PraveenKadkol | last post by:
I have 25000 Rows, that needs to be inserted into Oralce table from MsAccess When i run below code, i am not getting any error message, Still records are not inserting into destination table. ...
0
by: bhavika | last post by:
i am fetching table data (2 columns)from database in my JSP Page, There, my first column is checkbox Now as checkbox is checked, that particular row should be selected and should be dislpayed in...
1
by: evenlater | last post by:
I have an Excel workbook that I'm programming from Access. The rows in the workbook vary in height. So let's say row 8 is taller than the rows above it. If I *manually* insert 2 new rows at the...
9
by: Adam Adams | last post by:
Hai I need some help, for the record I am new to VB and access I have two tables (parent) and (child) . I want to count the number of children for each parent. I want to use date of birth and not...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.