473,499 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass variable into View?

Hi,

I'm trying to write a view that returns a historical view of records
as of a certain date. The records come from a live and historical
table and I need to return the records as they were in the live table
on various dates. The SQL to do this is no problem but it requires a
date value in a where clause in an inner select (the sql is below for
reference - the date value that needs to be variable is hardcoded as
'01/01/2001'). Can I somehow pass this into a view or is a view the
correct approach?

Thanks,
Mark

CREATE OR REPLACE VIEW CGPPR_GLOBAL_FPS_AT_DATE ( GLOBAL_FP_ID,
GLOBAL_FP_PRICE, GLOBAL_FP_COMMENT, GLOBAL_FP_TBU, GLOBAL_FP_DISC_CAT,
GLOBAL_FP_VOL_DISC, GLOBAL_FP_PARTNER_PRICE, GLOBAL_FP_LIST_PRICE,
GLOBAL_FP_MSCAT, GLOBAL_FP_WPCAT, GLOBAL_FP_EFF_DATE,
GLOBAL_FP_MOD_WHO, GLOBAL_FP_MOD_DATE )
AS
Select tblA.* From (
Select GLOBAL_FP_ID, GLOBAL_FP_PRICE, GLOBAL_FP_COMMENT,
GLOBAL_FP_TBU, GLOBAL_FP_DISC_CAT, GLOBAL_FP_VOL_DISC,
GLOBAL_FP_PARTNER_PRICE, GLOBAL_FP_LIST_PRICE, GLOBAL_FP_MSCAT,
GLOBAL_FP_WPCAT, GLOBAL_FP_EFF_DATE, GLOBAL_FP_MOD_WHO,
GLOBAL_FP_MOD_DATE
From cgppr_global_fps
UNION ALL
Select GLOBAL_FP_ID, GLOBAL_FP_PRICE, GLOBAL_FP_COMMENT,
GLOBAL_FP_TBU, GLOBAL_FP_DISC_CAT, GLOBAL_FP_VOL_DISC,
GLOBAL_FP_PARTNER_PRICE, GLOBAL_FP_LIST_PRICE, GLOBAL_FP_MSCAT,
GLOBAL_FP_WPCAT, GLOBAL_FP_EFF_DATE, GLOBAL_FP_MOD_WHO,
GLOBAL_FP_MOD_DATE
From cgppr_global_fps
) tblA,
(
Select GLOBAL_FP_ID, Max(GLOBAL_FP_MOD_DATE) GLOBAL_FP_MOD_DATE
From
(
Select GLOBAL_FP_ID, GLOBAL_FP_MOD_DATE
From cgppr_global_fps
UNION
Select GLOBAL_FP_ID, GLOBAL_FP_MOD_DATE
From cgppr_h_global_fps
)
Where GLOBAL_FP_MOD_DATE < to_date('01/01/2001', 'dd/mm/YY')
Group By GLOBAL_FP_ID
) tblB
Where tblA.GLOBAL_FP_ID = tblB.GLOBAL_FP_ID
And tblA.GLOBAL_FP_MOD_DATE = tblB.GLOBAL_FP_MOD_DATE
WITH READ ONLY;
Jul 19 '05 #1
1 6578
Hello, Mark,

near 09:11 19-Jul from zz******@hotmail.com:
Hi,

I'm trying to write a view that returns a historical view of records
as of a certain date. The records come from a live and historical
table and I need to return the records as they were in the live table
on various dates. The SQL to do this is no problem but it requires a
date value in a where clause in an inner select (the sql is below for
reference - the date value that needs to be variable is hardcoded as
'01/01/2001'). Can I somehow pass this into a view or is a view the
correct approach?
Try to use package variable (or user-defined function) in view. Set the
value before using view.
Thanks,
Mark


[...]

--
wbr,
Wit.
Jul 19 '05 #2

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

Similar topics

6
9624
by: HH | last post by:
I'm learning to design web applications with php, mysql, and apache from a book. I copied a sample application called guestbook 2000 that came with the CD in the book to my htdocs folder, but...
3
78616
by: Benito | last post by:
Hi Everyone, Is there an easy way that I could pass a filter (variable) unto a view via stored procedures? I would appreciate your suggestions. Benito
110
9809
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
23
12221
by: John | last post by:
Last year, I remember finding a web page describing how to pass the name of a file to another web page, and have that web page load that image file. Now, I can't find my record of that (it was...
7
21580
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
8
1556
by: Blue Ocean | last post by:
I know this is somewhat dependent on the circumstances, but let me ask anyway. Suppose I have a 100 byte struct or array or something like that. Which would be more efficient? void...
0
2380
by: weiwei | last post by:
Hi; I am having trouble to get variable from grid view. here is my scenario. I want to delete a row in database from web page, in additon, I also want to delete that user's directory in c:drive. ...
1
481
by: Mark | last post by:
Hi, I'm trying to write a view that returns a historical view of records as of a certain date. The records come from a live and historical table and I need to return the records as they were in...
12
11004
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
7014
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
7180
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,...
1
6905
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
5485
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,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4609
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
3108
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
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.