?
Solved

sys_context in the view and using in oracle forms

Posted on 2010-08-13
6
Medium Priority
?
772 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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…
Via a live example, show how to take different types of Oracle backups using RMAN.
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.
Suggested Courses

801 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