Help - Tuning query based on status column
Hi,
I have a query wherein I need to fetch records based on the values in the status column. It can hold values 'A' and 'P'. A record can have an 'A' record and a 'P' record. My conditions are,
1) When only 'A' record is there, then return 'A' record,
2) When 'A' and 'P' record is there, then return 'A' record,
3) When 'P' record only is there, then return 'P' record.
There are approx. 3 lac 'A' records and 3K 'P' records. I tried using "with" clause queries but the performance is too bad and I am not able to use it. When executing as standalone queries 'A' records retrieval is faster as compared to 'P' records. When executing in "with" clause the query hangs. Can someone please help how this can be handled?
Due to restrictions, I will not be able to post the actual code. I am posting a sample here.
Sample code:
WITH q1 AS
(SELECT *
FROM tab
WHERE status = 'A'),
q2 AS
(SELECT *
FROM tab
WHERE status = 'P'),
q3 AS
(SELECT *
FROM q1
UNION ALL
(SELECT *
FROM q2
WHERE NOT EXISTS (SELECT 1
FROM q1)))
SELECT *
FROM q3
WHERE ROWNUM < 501;Thanks,
Vijay K
Vijay K wrote:
Hi,
I have a query wherein I need to fetch records based on the values in the status column. It can hold values 'A' and 'P'. A record can have an 'A' record and a 'P' record. My conditions are,
1) When only 'A' record is there, then return 'A' record,
2) When 'A' and 'P' record is there, then return 'A' record,
3) When 'P' record only is there, then return 'P' record.
There are approx. 3 lac 'A' records and 3K 'P' records. I tried using "with" clause queries but the performance is too bad and I am not able to use it. When executing as standalone queries 'A' records retrieval is faster as compared to 'P' records. When executing in "with" clause the query hangs. Can someone please help how this can be handled?Complicated problem!
Here are some ideas:
1. Use subqueries to avoid 'P' rows when corresponding 'A' rows exist. The EXISTS operator should be efficient if the lookup columns in the subquery are indexed.
2. Get lists of 'A' and 'P' records and use set operators UNION and/or MINUS to include/exclude the rows you want - if you don't have to include the 'A' /'P' values themselves
Similar Messages
-
Grouping Inner Query based on a column.Please help
I have a strange query.
I am using Subquery to display the count of rows from the inner query
depending upon the value of 'Y' or 'N'
Trade
id_entity id_inst_code_type id_inst_code dt_trade
AGL SE 5660249 10-Feb-06
AGL SE 5660249 13-Feb-06
AGL SE 5660249 13-Feb'06
Instrument_xref
ID_inst id_inst_xref_type id_inst_xref flg_active
0029010 SE 5660249 Y
0070789 SE 5660249 Y
0071190 SE 5660249 Y
0072385 SE 5660249 Y
0073215 SE 5660249 Y
0084797 SE 5660249 Y
0091375 SE 5660249 Y
0094690 SE 5660249 Y
0104438 SE 5660249 Y
My output:
id_inst_code_type id_inst_code Earliest Latest Total Active
SE 5660249 10 Feb 06 13 Feb 06 3 9
2) If all the 'flg_active' column in Table Instrument_xref is set to 'N'
the Active should be 0.
3) Assume that the flg_active could be 3 Y's and 6 N's then what?
id_inst_code_type id_inst_code Earliest Latest Total Active
SE 5660249 10 Feb 06 13 Feb 06 3 0
How do I check for the 'Y' or 'N' value in my code below ?
Help appreciated as the the functionality changes by the hour...
select tie.id_entity 'Entity',
tie.id_inst_code 'Inst Code',
min(tie.dt_trade) 'Earliest',
max(tie.dt_trade) 'Latest',
count(*) 'Total',
dt.InnerTotal 'Active'
from trade_input_event tie,
(Select insx.id_inst_xref_type,
insx.id_inst_xref,
insx.flg_active,
count(*) InnerTotal
from instrument_xref insx
where insx.id_inst_xref = '5660249'
---** Do I need to Check the flg_active here..
---** Do I need to use the Having clause here? ie having count(insx.id_inst_xref) = 'N'
group by insx.id_inst_xref_type,insx.id_inst_xref,insx.flg_active) dt
where tie.id_inst_code = dt.id_inst_xref
and tie.id_entity = 'AGL'
group by tie.id_entity, tie.id_inst_code_type,tie.id_inst_codeAs the flg_active is set to 'Y', I am trying to set it to 'N' in the query
so that count of 0 is returned, but this displays nothing.
Please help as to how to display a count(*) of 0 when the flg_active is 'N'??
Select insx.id_inst_xref_type,
insx.id_inst_xref,
insx.flg_active,
count(*) InnerTotal
from instrument_xref insx
where insx.id_inst_xref = '5660249'
and insx.flg_active = 'N'
group by insx.id_inst_xref_type,insx.id_inst_xref,insx.flg_active) dt -
Help on query : How to produce columns based on rows?
Hi All,
I have a table table1 with below structure and data
Item State Value
A1 MS 100
A1 GOA 3
A1 UP 4
B2 MS 34
B2 GOA 55
B2 PB 3
B2 DL 4
B3 MS 99
B3 TN 1I have an requirement to query this table and generate below output
Item MS GOA UP PB DL TN
A1 100 3 4 0 0 0
B2 34 55 0 3 4 0
B3 99 0 0 0 0 1The issue here is that we can have more State codes hence accordingly the query should dynamically return those number of columns
Is there any way to produce above output? Any help will be appreciated.
Oracle DB Version - Oracle 8i
Thanks in advance!Hi,
That's called a pivot .
The basic tecnique is something like:
SELECT item
, SUM (CASE WHEN state = 'MS' THEN value ELSE 0) AS ms
, SUM (CASE WHEN state = 'GOA' THEN value ELSE 0) AS goa
, SUM (CASE WHEN state = 'UP' THEN value ELSE 0) AS up
, SUM (CASE WHEN state = 'PB' THEN value ELSE 0) AS pb
, SUM (CASE WHEN state = 'DL' THEN value ELSE 0) AS dl
, SUM (CASE WHEN state = 'TN' THEN value ELSE 0) AS tn
FROM table_x
GROUP BY item;but this requires you to know how many states there are, and what they are, when you write the query.
Since you don't, you need to run a preliminary query that will generate a SELECT statement like the one above, or at least the SUM expressions for the variable columns. That's called dynamic SQL , and a technique for doing that is included below. (The example uses COUNT, but any aggregate function, including SUM, will work.)
Another possibility is String Aggregation, where instead of individual columns for each state, you have one huge VARCHAR2 column, formatted to look like separate columns. The tools avaiable for doing that in Oracle 8.1 are pretty poor, however, so I think you're better off with dynamic SQL.
How to Pivot a Table with a Dynamic Number of Columns
This works in any version of Oracle
The "SELECT ... PIVOT" feature introduced in Oracle 11
is much better for producing XML output.
Say you want to make a cross-tab output of
the scott.emp table.
Each row will represent a department.
There will be a separate column for each job.
Each cell will contain the number of employees in
a specific department having a specific job.
The exact same solution must work with any number
of departments and columns.
(Within reason: there's no guarantee this will work if you
want 2000 columns.)
Case 0 "Basic Pivot" shows how you might hard-code three
job types, which is exactly what you DON'T want to do.
Case 1 "Dynamic Pivot" shows how get the right results
dynamically, using SQL*Plus.
(This can be easily adapted to PL/SQL or other tools.)
NOTE: Using SQL*Plus file I/O, as in this example, is just
one of many ways to do dynamic SQL.
PROMPT ========== 0. Basic Pivot ==========
SELECT deptno
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst_cnt
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk_cnt
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS manager_cnt
FROM scott.emp
WHERE job IN ('ANALYST', 'CLERK', 'MANAGER')
GROUP BY deptno
ORDER BY deptno
PROMPT ========== 1. Dynamic Pivot ==========
-- ***** Start of dynamic_pivot.sql *****
-- Suppress SQL*Plus features that interfere with raw output
SET FEEDBACK OFF
SET PAGESIZE 0
SPOOL p:\sql\cookbook\dynamic_pivot_subscript.sql
SELECT DISTINCT
', COUNT (CASE WHEN job = '''
|| job
|| ''' ' AS txt1
, 'THEN 1 END) AS '
|| job
|| '_CNT' AS txt2
FROM scott.emp
ORDER BY txt1;
SPOOL OFF
-- Restore SQL*Plus features suppressed earlier
SET FEEDBACK ON
SET PAGESIZE 50
SPOOL p:\sql\cookbook\dynamic_pivot.lst
SELECT deptno
@@dynamic_pivot_subscript
FROM scott.emp
GROUP BY deptno
ORDER BY deptno
SPOOL OFF
-- ***** End of dynamic_pivot.sql *****
EXPLANATION:
The basic pivot assumes you know the number of distinct jobs,
and the name of each one. If you do, then writing a pivot query
is simply a matter of writing the correct number of ", COUNT ... AS ..."\
lines, with the name entered in two places on each one. That is easily
done by a preliminary query, which uses SPOOL to write a sub-script
(called dynamic_pivot_subscript.sql in this example).
The main script invokes this sub-script at the proper point.
In practice, .SQL scripts usually contain one or more complete
statements, but there's nothing that says they have to.
This one contains just a fragment from the middle of a SELECT statement.
Before creating the sub-script, turn off SQL*Plus features that are
designed to help humans read the output (such as headings and
feedback messages like "7 rows selected.", since we do not want these
to appear in the sub-script.
Turn these features on again before running the main query.
*/ -
Help! Piechart based on checklist column
Hello,
I'm writing this email in regards to difficulties I'm having in making a piechart based on data included solely in one column. First and foremost, I'm trying to make a comprehensive spreadsheet that depicts the check payment status of my organization's clients. To simplify the data and make things easier to view, I set up my spreadsheet in a checklist-format.
As you can see in this image http://www.flickr.com/photos/allanfromchicago/5716840963/in/photostream/ the column I'm trying to base my chart data on is called "Checks Denied." This column shows, in checklist format, those clients whose checks were denied by my bank- for various reasons. The customers who have a check in this column are those whose checks unfortunately did not go through.
In the data, 3 out of 67 clients so far have a check for the "Check Denied Column" which translates to roughly 4.5% of checks being denied. To illustrate the % of customers whose checks went through against the % whose checks unfortunately did not, I decided that a pie chart would be the best vehicle. However, the result was far from successful. Based on this image, http://www.flickr.com/photos/allanfromchicago/5717406596/in/photostream/ you can see that the independent variables are based on each client (all 67 of them), which is far from the desired outcome. Even though I'm only highlighting the "Checks Denied" Column, Numbers is pulling data from the associated rows.
Is it possible to just base my piechart on the one column and have the simple 2 variable legend I'm looking for?
Here are the links once more:
http://www.flickr.com/photos/allanfromchicago/5717406596/in/photostream/
http://www.flickr.com/photos/allanfromchicago/5717406596/in/photostream/
Please note that clicking on the image will allow you to zoom in.
Thanks for reading and I'll be looking forward to your responses.
-AllanAllan,
There is a common misconception among newcomers that a Pie Chart can look at a column of data and figure out what to do with it. It's a pretty dumb function. You must do the ground work. Further, X vs.Y data and Value vs. Category data are not amenable to Pie Charting. A pie chart takes a 1-dimensional list and charts it as parts of a whole.
So, if you want a Pie Chart to show that 25% of checks bounced and 75% cleared, you must have a table with the values 25% and 75% in it and chart that table. Or, alternately, a table with the number of checks that cleared and the number that bounced. You have to sum up the good checks and the bad checks and only then chart the sums.
Jerry -
Auto numbering Column id and filter this lookup id in another list based on status="active"
Hi,
I am trying to autonumbeirng the column id with default column ID. But it is not reset if i delete the list item. Also i want this id in another column which have status="Active". How i will do this?
Thanks in Advance.
RoopeshHi,
According to your description, my understanding is that you want to reset the column ID when you delete the list item and then you want to filter the id in another list based on status.
For resetting column id, there is no direct way to achieve it. I suggest you can save the list as a template and recreate the list. ID columns will always keep incrementing and will never be reused.
Here is a similar thread about reset column ID for your reference:
https://social.technet.microsoft.com/Forums/sharepoint/en-US/848a3d73-6273-45fa-806f-96312a4d71d1/is-there-anyway-to-reset-the-default-id-number-that-sharepoint-gives-to-an-item-back-to-1?forum=sharepointgeneralprevious
For filtering look up field, here are some detailed demos for your reference:
http://filteredlookup.codeplex.com/
https://social.technet.microsoft.com/Forums/en-US/d23d6e9b-dc7b-4741-8746-dd4bf00b8110/how-to-filter-lookup-column-in-sharepoint-2010
v
Thanks
Best Regards
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jerry Guo
TechNet Community Support -
Grouping column in same table based on status of other column
Hi,
MyTable( eid, ename, status, did);
MyTable2(did,dname);
Status column have data in 1/2.
did is forieng key to Mytable2.
i want o/p like:
DNAME , count(eid with status =1) ,count(eid with status = 2)
Please help me in writing query.
Regards,
KrishnaOne possibility (untested):
SELECT DNAME
, COUNT((CASE WHEN STATUS=1 THEN 1 ELSE NULL END)) CNT_STATUS_1
, COUNT((CASE WHEN STATUS=2 THEN 1 ELSE NULL END)) CNT_STATUS_2
FROM MyTABLE
JOIN MyTABLE2 ON MyTABLE.DID = MyTABLE2.DID
GROUP BY DNAME -
Need help tuning slow running query
Need help tuning below two Oracle queries:
Query #1:
======================
SELECT "WORK_ORDER_FACT_ALL_YESTERDAY"."WORK_ORDER_HISTORY_ID",
"WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_NUMBER",
"ACCOUNT_DIM"."ACCOUNT_NUMBER", "ACCOUNT_DIM"."ACCOUNT_WS_DISC_DATE"
FROM "CDWD"."WORK_ORDER_FACT_ALL_YESTERDAY" "WORK_ORDER_FACT_ALL_YESTERDAY",
"CDWD"."ACCOUNT_DIM" "ACCOUNT_DIM"
WHERE (SUBSTR ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_FIRST_NAME", 1, 1) =
SUBSTR ("ACCOUNT_DIM"."ACCOUNT_FIRST_NAME", 1, 1)
AND (SUBSTR ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_LAST_NAME", 1, 4) =
SUBSTR ("ACCOUNT_DIM"."ACCOUNT_LAST_NAME", 1, 4)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_DL_NUMBER" =
"ACCOUNT_DIM"."ACCOUNT_DL_NUMBER"
AND "WORK_ORDER_FACT_ALL_YESTERDAY"."WO_TYPE_CODE" IN ('25', '27')
AND ("ACCOUNT_DIM"."REVENUE_TYPE_ID" = 1)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."TRANSFER_COUNT" = 0)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."WINBACK_ADD_COUNT" = 0)
AND ("ACCOUNT_DIM"."ACCOUNT_WS_ENTRY_DATE" <
(TO_DATE ('2006.05.02', 'yyyy.mm.dd') - 11
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."IS_DERIVED" = 0)
AND ("ACCOUNT_DIM"."EXPIRATION_DATE" IS NULL)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACT_ACCOUNT_TYPE_CD" <> '50');
Query #2
==================
UPDATE work_order_fact_all_yesterday g
SET returns_count = 1
WHERE EXISTS (SELECT 1
FROM (SELECT a.phone_dim_key AS transactional_phone_dim_key,
b.mdn_number AS transactional_mdn_number,
b.account_number AS transactional_account_number
FROM work_order_fact_all_yesterday a INNER JOIN phone_dim b ON a.phone_dim_key = b.phone_dim_key
WHERE a.gross_deactivations_count = 1) e
INNER JOIN (SELECT c.phone_dim_key AS historical_phone_dim_key,
d.mdn_number AS historical_mdn_number,
d.account_number AS historical_account_number
FROM (SELECT phone_dim_key
FROM work_order_activity_fact
WHERE gross_adds_count = 1
AND report_date >= :b1 - 66
AND NVL (is_derived, 0 ) = 0
UNION
SELECT phone_dim_key
FROM work_order_fact_all_yesterday
WHERE gross_adds_count = 1
AND is_derived = 0) c
INNER JOIN phone_dim d ON c.phone_dim_key = d.phone_dim_key ) f
ON e.transactional_mdn_number = f.historical_mdn_number
AND e.transactional_account_number = f.historical_account_number
WHERE e.transactional_phone_dim_key = g.phone_dim_key)
AND g.gross_deactivations_count = 1
AND g.account_revenue_type_id = 1;
I ran the DBMS_SQLTUNE on it for 10g and did not get any advice. How can I tune the above queries? Thanks!Tune the SQL? Looking at the join criteria of SUBSTR("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_FIRST_NAME", 1, 1) = SUBSTR ("ACCOUNT_DIM"."ACCOUNT_FIRST_NAME", 1, 1) and other substrings, it seems to me that you have basic flaws in your relation design.
Column must be atomic values. Having to extract a sub-set value from a column to create the intelligence needed to join to another table - that is just plain wrong in relation design. Never mind the performance impact and overheads it causes in the database. -
Creating a Status column (IF statement/calculated column)
I'm developing list for managing a project with 11 columns each representing a project milestone.
We'll call them A,B,C...K.
"A" representing a status of "Project Started" and K representing "Project Complete" with various statuses in between.
When a milestone has been reached, the date is input into the appropriate column. So when the project is complete, there will be dates in all columns A-K
I wish to incorporate a new column that indicates the current status depending on if columns A-K have been filled in.
So if all columns are blank, a status of "Awaiting start" is indicated.
If column A is filled in with a date, a status of "A" is indicated.
If columns A and column B are filled in then a status of "B" is indicated.
If columns A, B and C are filled in then a status of "C" is indicated. * * If all the columns are filled in with dates, a status of "K" is indicated.
Any ideas? Some form of If statement in a calculated Status column?Hello,
You can use nested if statement something like below.
For example, I have one column named as 'Score' and the requirement is to perform quartile breakup based on score so for that I can use below calculated formula in my calculated column.
=IF(INT(Score)>85,"85 Above"
,IF(AND(85>=INT(Score),INT(Score)>=80),"85-80"
,IF(AND(79>=INT(Score),INT(Score)>=75),"79-75"
,IF(INT(Score)<75,"Below 75","0"))))
Have below links for more details.
Calculated Field Formulas
Examples of common formulas
Thanks. Please mark it as an answer if it helped. -
SELECT QUERY BASED ON SECONDARY INDEX
Hi all,
CAN ANYONE TELL ME HOW TO WRITE SELECT QUERY BASED ON SECONDARY INDEX.
IN WHAT WAY DOES IT IMPROVE PERFORMANCE.
i KNOW WHEN CREATING SECONDARY INDEX I NEED TO GIVE AN INDEX NO -iT SHOULD BE ANY NUMBER RIGHT?
I HAVE TO LIST ALL PRIMARY KEYS FIRST AND THEN THE FIELD FOR WHICH I AM CREATING SECONDARY INDEX RIGHT?
LETS SAY I HAVE 2 PRIMARY KEYS AND I WANT TO CREATE SEONDARY INDEX FOR 2 FIELDS THEN
I NEED TO CREATE A SEPERTE SECONDARY INDEX FOR EACH ONE OF THOSE FIELDS OR ONE SHOULD BE ENOUGH
pLS LET ME KNOW IF IAM WRONGHI,
If you cannot use the primary index to determine the result set because, for example, none of the primary index fields occur in the WHERE or HAVINGclauses, the system searches through the entire table (full table scan). For this case, you can create secondary indexes, which can restrict the number of table entries searched to form the result set.
You create secondary indexes using the ABAP Dictionary. There you can create its columns and define it as UNIQUE. However, you should not create secondary indexes to cover all possible combinations of fields.
Only create one if you select data by fields that are not contained in another index, and the performance is very poor. Furthermore, you should only create secondary indexes for database tables from which you mainly read, since indexes have to be updated each time the database table is changed. <b>As a rule, secondary indexes should not contain more than four fields</b>, <b>and you should not have more than five indexes for a single database table</b>.
<b>What to Keep in Mind for Secondary Indexes:</b>
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eb2d446011d189700000e8322d00/content.htm
http://www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm
Regards
Sudheer -
Workflow to grant access to each List item based on a column value
Hi,
I have 2 lists Risks and RisksLookup.
In Risks, I have Title, Description, service impacted and status columns.
In RisksLookup, I have service impacted, AD1, AD2, AD3, AD4 and AD5.
I have a requirement where in I have to write a Workflow to provide access to each List item based on the value of service impacted. i.e. If service impacted in Risks List is Client A, I have to lookup what all AD groups are present for Client A in RisksLookup
List and provide access to only those groups for that item.
Regards, Shreyas R SHi
another approach
create 5 more lists, dedicated to each impacted service. for Each one these lists apply needeed right ( based onAD groups )Keep you main list where first level will add new items . Attach a workflow to this main list, which will start when an item
is added and which will add specific item's value to his new list ( based on impacted service value )
Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you. -
SPD 2013 WorkFlow Status Column: Status Not Updated
We are having an issue with the status display of the SPD Designer Workflow status column which is a read only column added by SharePoint to show the status of the workflow. We have some SharePoint 2013 Workflows built using SharePoint Designer that are
attached to specific SharePoint Document Libraries. The expected behavior is for this column to show the workflow statuses (Not Started, Starting Workflow, In Progress and Completed.
Based on our observation this status is showing up although the column does get added for the Workflow that we have. Is there any other dependency for SPD Workflows that are attached to Document Libraries to show the status correctly? Any other settings/configurations
to be made?
Regards,
Vikram
Blog: http://dotnetupdate.blogspot.com |Hi Venkadesh,
It is by design that 2013 workflow will show stage name in the workflow status column when
Automatically update the workflow status to the current stage name is checked.
And the workflow status column will be blank when Automatically update the workflow status to the current stage name is unchecked.
For existing workflows, the workflow status will still exists with the previous values after unchecking Automatically update the workflow status to the current stage name.
We can use Set Workflow Status action to update the workflow status value based on our needs.
Best regards,
Victoria
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Workflow status column in AllUserData Table with wrong coded in Content Database?
I would like to write a stored procedure to find out all workflow instances with errors, directly from content database.
I go to dbo.alllists to find out the workflow status column, and query AllUserData and find out not readable text
like:
쳀曩쌙䂻֞鼥
㖦巀䐝义颹暲ﻇൿ
ﱰ臨臸䋖ហ嬀ᨵ瘉
鄌幀鴏䔖튅㐻⩷揬
묨ή姖䩡ꊎ鉛۬浶
⟯봨飮䙕잳摕盜⣢
屑䳬鑥䶵岿珽磯Â
ꬁᆈ䀥䓝䶲紀篰䟫
蓏ꋦ䥌肃瘓⯈᭄
뵎㎙䈸䪿蔀ࢴ
෬꧋辂䘀馻ࡲ琓
ꞎ鵫䬺ࢬ䀒✫ꡱ
any ideas?Hi,
Thanks to share your post.
For the issue, I think it may due to the wrong handling of the encoding type “UTF-8”, please refer to the followed article, they may give you a hand:
http://blogs.sun.com/shankar/entry/how_to_handle_utf_8.
http://devlog.info/2008/08/24/php-and-unicode-utf-8/.
Hope this could help you!
Leo -
Hi,
Maybe someone could help me with the following. I think it is a shortcoming of HTMLDB, but I'm not sure.
I've got a Select List item, P10_PERSON, which resides in a tabular form. The Select List is based on a query, say:
select name display_value
, id return_value
from personAs is should be, P10_PERSON shows only the names.
When my action is an insert or modification, the results will be writen in the table PERSON_MEETING.
Now I want to make sure that the same person coulden't be selected a second time for the same meeting. So I alter the query based LOV with the following:
select name display_value
, id return_value
from person
where id not in (select person_id
from person_meeting
where meeting_id = :P10_MEETING_ID)This sounds correct and works in Designer, but not in HTMLDB. The NAME isen't shown anymore, instead the ID is shown in the page.
Is this because the person doesen't actually exists anymore in the LOV after it has been saved (stored in PERSON_MEETING)? If so, does anyone knows a work-around?
Thx!
Message was edited by:
F. Klein
(removed typing error)I've got 3 tables. PERSON, MEETING and PERSON_MEETING.
They have the following structure:
# PERSON #
# ID NUMBER #
# NAME VARCHAR2(50) #
# MEETING #
# ID NUMBER #
# DESCRIPTION VARCHAR2(100) #
# PERSON_MEETING #
# ID NUMBER #
# PERSON_ID NUMBER #
# MEETING_ID NUMBER #
#####################In PERSON there are 3 records, in MEETING there is only 1.
PERSON:
ID NAME
1 KEVIN
2 BILL
3 JOHN
MEETING
ID DESCRIPTION
1 DEVELOPERS MEETINGNow I want to link the persons to a meeting in the PERSON_MEETING table.
The column MEETING_ID will be filled automatically through a variable or parameter (I don't know the exact term).
I defined the PERSON_ID column as an query based select list with the query:
select name display_value
, id return_value
from personThis works perfectely, the select list (or lov) shows KEVIN, BILL and JOHN. When I select BILL and save my adjustment, the following record will be shown in PERSON_MEETING
PERSON_MEETING
ID PERSON_ID MEETING_ID
1 2 1Now that I inserted BILL as a participant for the Developers meeting he should be removed from the select list. Only KEVIN and JOHN should be in the list. Therefore I change the query of the select list into:
select name display_value
, id return_value
from person
where id not in (select person_id
from person_meeting
where meeting_id = :MEETING_ID):MEETING_ID is the item in the page containing the ID of the meeting.
When I make this adjustment, the select list only contains KEVIN and JOHN (as it should), but the first record shown on the page (record with BILL) doesen't show BILL anymore, instead his ID will be shown (2)... -
Select List (query based LOV) in V. 4.1.1.00.23
Hi guys,
I am having some problems with an APEX application that I have exported from V. 4.1.0.00.32 and imported on V. 4.1.1.00.23.
I have a Tabular Form region where I have a column which is Display As "Select List (Query based LOV)".
If I add a new row - choose a new value (not the same as any of the above rows) and "Apply Changes"/"Submit" the value in the new row changes to the value of the 1. row of the tabular form :-( I can update this new row and then it saves the right value... It looks like it is only when inserting a new row.
Is this a bug or is it a feature ;-)
Hope you can help...
/ReneLeo,
Thanks for the response, but I don't think you quite understand my problem. If I go to the Column Attributes screen for the group_id field, I have the "Display As" drop down set to "Select List (query based LOV)", not "Select List (named LOV)". This requires that the sql query be written in the "List of values definition" text area below. Within that text area I have the following query:
SELECT DISPLAY_NAME, GROUP_ID
FROM APPLICATION_GROUPS
WHERE APP_ID = ?????
ORDER BY 1
The APP_ID that I need to reference is for the current row of data that is being processed. Therefore, I can't use a :PNNN_APP_ID variable, because that field does not exist on the page.
Hopefully this explains it a little better.
Thanks,
Kris -
MAKE BUTTON CONDITIONAL DISPLAY IN A REPORT BASED ON STATUS OF COL VALUE
hello,
can anyone help me out with this issue.
Like I have a normal SQL report with buttons update,delete,insert and I wanted to display these buttons conditionally based on the value of the "status" column.
For Example: if the status columnvalue is 'DEV' then only display the buttons otherwise don't display them.
thanks,
OrtonI would use a CASE statement in the select....
each CASE would be an img src tag for a different button if the button is an image.
does that make sense? I can include an example if you would like...
Maybe you are looking for
-
Embedded Text - Animation problem
Hi All, I'm having a strange problem with animated text and embedded fonts. The best way to explain is to show you... When I don't embed the font, the problem goes away. It happens in both IE and Firefox and on multiple machines. I've also tried diff
-
How do you play an album in the correct order?
Just bought an ATV. 160GB model, software version 2.3. I've synched it to my MacBook's iTunes library, and it plays music fine. However, I can't find a way to simply play an album in the correct sequence. If I navigate to an album and open, the only
-
How does the System.in.read() works?
Hi!I'm trying to read some chars from the console.So here is my code of reading the two chars: char ch1='\u0000'; char ch2='\u0000'; System.out.print("Enter the first char:"); ch1=(char)System.in.read(); System.in.r
-
Hi, Please let me know how to enable GOS(Geniric object services) for a standard transaction. Thank you Srinvas
-
How to setup daily incremental loads
Hi: OBIEE 11.1.1.6 OBIA 7.9.6.3 I've been building and configuring OBIA in a test environment, and I'm planning the go-live process. When I move everything to production, I'm sure I would need to do a full load. My question is, what do I need to do t