Solved

sys_context in the view and using in oracle forms

Posted on 2010-08-13
6
758 Views
Last Modified: 2013-12-19
CREATE OR REPLACE VIEW QC_DAILY_VW
(DEPT_ID, QC_TYPE_ID, QC_SUBTYPE_ID, QC_DATES, CONTROL_NO)
AS
select a.dept_id,a.qc_type_id,
      a.qc_subtype_id,b.qc_dates,b.control_no
from qc_dept_subtypes a,qc_daily b
where a.dept_id = b.dept_id(+)
and a.qc_subtype_id = b.qc_subtype_id(+)
and a.qc_type_id = b.qc_type_id(+)
--and a.dept_id = 11
and b.qc_dates(+) = to_date(sys_context('mydate','given_date'),'dd/mm/rrrr')
-------------------
In my forms I call this in the post query
my_pkg.test_context(:qc_dept_subtypes.qc_dates);
First time the form is blank. when I close it and reopen then the data displays. Why is this happening.
0
Comment
Question by:anumoses
  • 5
6 Comments
 
LVL 6

Author Comment

by:anumoses
ID: 33433319
This is the problem I have
sys-context.doc
0
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
ID: 33433725
it's the "POST" query that is the problem

the view is based on the value of the context,  so it must be set BEFORE you read the view.

The context won't change unless you change it, so setting it once on the form is sufficient.

to fix it, set it before the form's query executes
0
 
LVL 6

Author Comment

by:anumoses
ID: 33444873
should I set it in the when-validate-trigger of the date filed? or when new form instance?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Author Comment

by:anumoses
ID: 33445196
I tried to set it in the when new block instance trigger of the view block. It still does not work. I commented tyhe line in post query and now I have it only in the when new block, but nothing works. But when I requery it brings the data.
0
 
LVL 6

Author Comment

by:anumoses
ID: 33445259
I set it on the date field on the first block. it works
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 33445286
Thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now