473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

one code for two tables

Can I do something like it:

if i = 0 then
for cur_var in (select * from t0) loop
else
for cur_var in (select * from t1) loop

/*
a lot of lines here
*/

end loop;

even if I would try to do like it:

v_refcursor refcursor;
v_rec0 t0%rowtype;
v_rec1 t1%rowtype;

BEGIN
if i = 0 then
OPEN v_refcursor FOR SELECT * FROM t0
else
OPEN v_refcursor FOR SELECT * FROM t1
end if;

I need to use different record_variables for FETCH and repeat my /* a lot of
lines here */ couples time for different record variables.

Any idea how to do code only once ?

Thanks

Jul 19 '05 #1
1 1937
"Julia Sats" <ju********@sympatico.ca> wrote in message news:<mr*******************@news20.bellglobal.com> ...
Can I do something like it:

if i = 0 then
for cur_var in (select * from t0) loop
else
for cur_var in (select * from t1) loop

/*
a lot of lines here
*/

end loop;

even if I would try to do like it:

v_refcursor refcursor;
v_rec0 t0%rowtype;
v_rec1 t1%rowtype;

BEGIN
if i = 0 then
OPEN v_refcursor FOR SELECT * FROM t0
else
OPEN v_refcursor FOR SELECT * FROM t1
end if;

I need to use different record_variables for FETCH and repeat my /* a lot of
lines here */ couples time for different record variables.

Any idea how to do code only once ?

Thanks


Redesign your database (recommended) and get rid of this mess
or use dynamic sql (not recommended, as you will end up with an
unscalable application).
Instead of hacking yourself out, like you seem to do consistently,
please try to *learn* and use approved practices, *design* your
programs and stop creating spaghetti.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Martin MOKREJ© | last post by:
Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: cat somefile.py a = 222 b = 111 c = 9
4
by: Paolo | last post by:
Friends, I need help with some code to export different tables to a single spreadsheet in Excel. My excel file is named REPORT and the spreadsheet is named CLIENTS. I do have the code to export...
8
by: Steve Jorgensen | last post by:
Hi folks, I'm posting this message because it's an issue I come up against relatively often, but I can't find any writings on the subject, and I haven't been able to figure out even what key...
1
by: DD | last post by:
I have the following code and my question is Do i use a Autoexec to fire this ? As: fGetLinkedTables("ODBC") Or how do i ?? do i replace the above as fGetLinkedTables("test_be") Or ???
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
2
by: NoSpam | last post by:
Hi, I am working with C# and ASP.NET with code behind and a SQL Server. I'm making an e-shop. When clients see what they have in their basket, I added a function DELETE to delete a line. It took...
2
by: Jim Devenish | last post by:
I am in the early stages of converting a back-end .mdb file to SqlServer - my first attempt! I have used Data Transformation Services to copy all the tables to SqlServer into a database named...
5
by: rdemyan via AccessMonster.com | last post by:
I have a need to add another field to all of my tables (over 150). Not data, but an actual field. Can I code this somehow. So the code presumabley would loop through all the tables, open each...
5
by: Will | last post by:
- I know enough ASP and Access to be dangerous :) - I need to put up a data base on our web server with 3 related tables. - They will be accessed by a limited number of people. - Each user will...
7
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.