473,382 Members | 1,107 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,382 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 1934
"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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?

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.