Solved

sys_context in the view and using in oracle forms

Posted on 2010-08-13
6
766 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
6 Comments
 
LVL 6

Author Comment

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

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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 videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

691 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