Select Records
I have an inventory report with a subreport.
The subreport tell me who puchased what, the main report groups that by ID then Color. The main report also tells me if I have any unused in inventory
ID
Color Available = 0
George W - 1
I have an inventory report with a subreport.
The subreport tells me who puchased what, the main report groups that by ID then Color. The main report also tells me if I have any unused in inventory
ID
Color
Available = 0
(sr) George W = 1
(sr) Susan O = 1
So, above example would = 2 on site
I pulled the total used from the subreport, but I would like to filter / select based on amount on site. But the total from the subreport only works when I put it in after the subreport.
I tried Select Expert, my formula isn't available to filter on
I tried conditional suppress on groups, but no good
Help?
Similar Messages
-
Is there any provision to view the selected record using SYS_REFCURSOR?
hi friends ,
I was using SQL Server . now i am shifting to Oracle . so we are changing the Stored Procedures in SQLServer to Oracle SP's. I have given the structure of procedure given below . If possible , i want to see the output of select statement in the TOAD editor . If any body knows please help me
CREATE OR REPLACE PROCEDURE PS_AON
P_STATUS OUT VARCHAR2,
P_CUR OUT SYS_REFCURSOR
AS
BEGIN
OPEN P_CUR FOR
select colum1,column2,column3 from Table 1;
EXCEPTION
WHEN OTHERS THEN
P_STATUS:=SQLERRM;
END;
This is one of the model of stored procedures i am using . And the editor i am using is TOAD 7.3.0 and oracle 9i. Is there any provision to view the selected records by running this procedure in TOAD editor
thanks & regards(assuming you have relatively recent version of TOAD).
Write a small block to call the procedure (or use Toad's 'execute procedure' option) as in the example below. Note the ':' in front of 'v_cur_out'. When you run the block, TOAD will prompt you for a value / datatype for 'v_cur_out'. Ignore the value, set the datatype to 'Cursor' and click OK. The resultset (if any) will be displayed in the Data Grid window below.
DECLARE
v_status VARCHAR2 (32767);
BEGIN
ps_aon (v_status, :v_cur_out);
DBMS_OUTPUT.PUT_LINE ('v_status => ' || v_status);
END;
/ -
How to get selected record details when single selection is used in a table
Hi All,
Inside a query region I have created a table using region wizard,for this table I have added a singleSelection Item. What I want is , on selection of a particular record i want to update or view that record in a new page , for this I have added update and view icons in each row.
But I am unable to get the particular selected record
OATableBean tableBean = (OATableBean)webBean.findChildRecursive("ResultTableRN");
OASingleSelectionBean singleSelection = (OASingleSelectionBean)tableBean.getTableSelection();
For this singleSelection object I was unable to find any method which will give the value of the view attribute associated with it.
Anybody any suggestions regarding it ?
Thanks in advance,
Anant NImbalkar.Hi Anant,
here is how you have to do it
1) you need to enable PPR on that Singl selection , by changining the Action type =fireAction.
2) define the envent , EVENT
3) define paramters for that event. This is place that gives you handle to the Attribute of VO.
So you can define paremters such
Name = PARAM1
value =${oa.EqxContactPrivEOVO1.ContactPrivilegeId}
You can define as many paramters as you can for the vo field that u wanted to have.
Now in the procesformRequest() , all you do it handle the event EVENT and get the parameters
if ("EVENT".equals(pageContext.getParameter(EVENT_PARAM)))
String accountid= pageContext.getParameter("PARAM1");
You can refer developer guide for further details. -
Hello folks,
Many times we need to retrieve records for given lists of PKs (or FKs), as:
p_pk_list := '11,22,33';
We work in 10g
A co-worker of mine had a good idea (I thought) to "help" the optimizer and build a recordset in the FROM clause and use it later in WHERE
SELECT ...
FROM tableName a,
(SELECT REGEXP_SUBSTR(p_pk_list, '[^,]+',1,ROWNUM) p_pk_id
FROM dual
CONNECT BY ROWNUM <= LENGTH(p_pk_list ) - LENGTH(REPLACE(p_pk_list ,','))) d_pk
WHERE
a.ID=d_pk.p_pk_id; -- (1)
The tragedy is that it takes 4 seconds to retrieve 5 records from the table (no other joins). The table has about 40 columns though and there are about 51000 records. With the SELECT REGEXP_SUBSTR in the WHERE clause, it's a bit worse.
If (1) is replaced by:
a.ID IN (11,22,33,44,55);
the execution takes 0.04 seconds.
My questions are:
1. Is this a bad idea to select records for a given list of PKs or FKs? Should one just go for one PK/FK instead?
2. Why the stiff performance penalty?
3. Ideally, it would be nice if this would work:
a.ID IN (p_array);
where p_array would be an array of integers
Any elegant sollutions?
Thanks a lot.
DanCheck the explain plan for both statements.
I would wager that the overhead you experience is due to the fact that you are comparing apples to oranges here.
(SELECT REGEXP_SUBSTR(p_pk_list, '[^,]+',1,ROWNUM) p_pk_id
FROM dual
CONNECT BY ROWNUM <= LENGTH(p_pk_list ) - LENGTH(REPLACE(p_pk_list ,','))) d_pkreturns a string.
a.ID IN (11,22,33,44,55);Is a list of numbers.
If you check the explain plan for the regexp version, you should see an implicit conversion being done for you (converting the number column into a string for comparison) which means you can't use any indexes defined on a.id.
If you want to use an array of numbers here's an approach using a built in array of numbers.
declare
v_number_list sys.odcinumberlist default sys.odcinumberlist();
begin
v_number_list.extend;
v_number_list(v_number_list.count) := 100;
v_number_list.extend;
v_number_list(v_number_list.count) := 200;
for vals in
select *
from all_objects
where object_id in
select column_value
from table(cast(v_number_list as sys.odcinumberlist))
loop
dbms_output.put_line(vals.object_name);
end loop;
end;
25 /
I_TYPED_VIEW1
I_NTAB2
PL/SQL procedure successfully completed.
ME_XE?Otherwise do an explicit TO_NUMBER on the regexp query so that you can use any indexes defined on the table in question. -
How to select records in ALV using FM
Hi guys,
How to select records in ALV using FM. Not the OO method. Thx in advance!
KunhI
by using REUSE_ALV_FIELDCATALOUG_MERGE. Iys fill field catalouge table as per internal table description. Then use REUSE_ALV_GRID_DISPLAY for display ALV REPORT.
**Please reward suitable points***
With Regards
Navin Khedikar -
How to edit the selected record through a popup page
Hi, can anyone help me to handle the case ?
1) In main page, there is a datatable showing the record list. Click a commandLink in the selected record to popup a screen for user edit.
2) The data is validated and then saved into database after clicking the submit button in the popup.
3) Finally, the main page is refreshed with the latest record list.
ThanksJust like any other servlet or form-processing script. What would a mere HTML page know about "systems"? Put the URL into the form destination attribute and be done.
-
Performance problem with selecting records from BSEG and KONV
Hi,
I am having performance problem while selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
Regards,
PrashantHi,
Some steps to improve performance
SOME STEPS USED TO IMPROVE UR PERFORMANCE:
1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
5. Avoid using nested SELECT statement SELECT within LOOPs.
6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
7. Avoid using SELECT * and Select only the required fields from the table.
8. Avoid nested loops when working with large internal tables.
9. Use assign instead of into in LOOPs for table types with large work areas
10. When in doubt call transaction SE30 and use the examples and check your code
11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
12. Use "CHECK" instead of IF/ENDIF whenever possible.
13. Use "CASE" instead of IF/ENDIF whenever possible.
14. Use "MOVE" with individual variable/field moves instead of "MOVE-
CORRESPONDING" creates more coding but is more effcient. -
JSF - Problem in Retrieving selected record from datatable
I am new to JSF and in the process of developing a new web application using JSF.
I have problem in retrieving the selected record from a datatable. I am using h:datatable tag and h:commandlink in a column for selecting a particular row on the datatable.
I have populated the data to the datatable by binding a bean and its property.
When I retrieve also I am binding to a bean in the action attribute of the h:commandlink tag in h:column of that datatable.But when I try to bind the bindign attribute of the h:datatable tag to the datatable instance in my Bean , my JSF File gets corrupted..
How to implement this without any issue??plz help me regarding this.HI
Try the below code
DATA lo_nd_del TYPE REF TO if_wd_context_node.
DATA lo_el_del TYPE REF TO if_wd_context_element.
DATA ls_del TYPE wd_this->Element_del.
DATA lo_nd_et_postab_1 TYPE REF TO if_wd_context_node.
DATA lo_el_et_postab_1 TYPE REF TO if_wd_context_element.
DATA ls_et_postab_1 TYPE wd_this->Element_del.
DATA lt_et_postab_1 TYPE wd_this->Elements_del.
DATA: wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
* navigate from <CONTEXT> to <ET_POSTAB_1> via lead selection
lo_nd_et_postab_1 = wd_context->path_get_node( path = `ZSHP_EXTENDED_DUE_LI.CHANGING_3.ET_POSTAB_1` ).
CALL METHOD lo_nd_et_postab_1->get_selected_elements
RECEIVING
set = lt_temp.
* navigate from <CONTEXT> to <DEL> via lead selection
lo_nd_et_postab_1 = wd_context->get_child_node( name = wd_this->wdctx_del ).
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_et_postab_1.
ls_et_postab_1-vbeln = del. // adding new attribute value.
APPEND ls_et_postab_1 TO lt_et_postab_1.
CLEAR ls_et_postab_1.
ENDLOOP.
lo_nd_et_postab_1->bind_table( new_items = lt_et_postab_1 ). -
Can we enable "Select record Set Message choice" of Table in left side
Hi ,
I have requirement to set the "Select Record Set " Message choice of a table region on left side.
Ex:If there are more records in a table region and message choice available to select next set of records.
You can chk in Workflow Status Monitor function.
Its the Navigation Bar to be @ left side on the table Region whcih allows you to navigate the records set.
Thanks,Sarath.
Edited by: SarathL on Dec 13, 2011 4:59 PMHi,
Not sure what exactly you are looking for.
The Next link and option to select next set of rows comes to your OA Table by default .. isn't it?
-Idris -
Selecting records from DEFAULT range-list subpartition
Is it possible to select records which belong to DEFAULT subpartition of a certain partition of a RANGE-LIST partitioned table, using subpartition pruning? Our task assumes creating partitions and subpartitions in a table dynamically before running ETL. But sometimes due to complexity of the path subpartition key goes from staging data to materialized views in data warehouse, we cannot predict all subpartition key values upfront. We can create DEFAULT subpartition for every partition though, and have Oracle place records which don't match any subpartition condition into that subpartition.
But later we need to split DEFAULT subpartition so that all records will go into their dedicated subpartitions, and DEFAULT will be left empty - other layers of our application need all records to be stored in subpartition other than DEFAULT in order to be available. For that, we need to know which keys are stored in DEFAULT subpartition. And the question is - how can we effectively achieve that?
The obvious "brute force" approach is to issue a query like:
select distinct subpart_key from mytable partition (myrangepartition) where not subpart_key in (list of all subpartition key values for this partition)
but it does not use partition pruning - I have checked execution plan. While it is possible to use only DEFAULT partition, this query will iterate through all subpartitions, which is huge performance impact. How can we instruct Oracle to use only DEFAULT subpartition?is the solution. I have overlooked this syntax - now my life is much easier.
-
Selecting records based on formula fields
Post Author: Mike Kennedy
CA Forum: Formula
I have created a field (called "Shortage") that is the result of subtracting two running totals and have inserted all three fields into the group footer. I only want to select those records that have a negative value as a result, but the field is not shown in the Select Expert. None of my formula fields show up in the Select Expert for some reason (normally they do). Does anyone know why and how can I select these records only? Thanks.Post Author: SKodidine
CA Forum: Formula
Running Totals are only available once the records are being read and processed. You are calculating the difference between two Running Totals and then want to use that to select records? I don't think that is possible. One way of accomplishing the display of groups which have a negative value is to use sum functions instead of the running totals and then in group selection criteria, display only those groups which have a negative value as a result of subtracting the two sums. -
Selecting records based on different fields
Post Author: timg
CA Forum: General
I have three groups which I study quite often, the blues (as identified in field 1with codes), the reds (identified in field 2 with codes), and the greens (identified in field 3 with certain codes).
I want to be able to run one report which, through a parameter field, I can select the group (red, green, or blue) for which I can select records from the database and analyze. Stated another way, if I select "Blue" in the parameter field, how can I get CR to pull certain records in the correct field with the correct codes.Post Author: yangster
CA Forum: General
dunno what your codes are but something like this will work if you put it in the section expertif ?para = "BLUE" then field1 in [a, b, c] elseif ?para = "RED" then field2 in [d, e, f] elseif ?para = "GREEN" then field3 in [g, h, i] -
Select Recording Source issue on Audigy 2
I unistalled and installed the program and can't get it to work. I have the Audigy 2 ZS plat. with the software and all. Problem I have when I open up the Organizer MediaSource Player everything works but the "select recording source" button or selection doesn't work. It's kind of blanked out as if I don't have that option at all. But when I go to the mixer I can here the line inputs but I can't record from it b/c I can't select it. If anyone has this issues let me know or how to solve it. I have windows XP and also my Audio Stream recorder doesn't work either.
Ok I got it to work. This is the reply I got from Creative but I didn't remove the program from the add/remove option on the PC b/c that didn't work at first. I inserted the installation CD and remove it from that wizard. Rebooted and the PC found new hardware. I then installed the driver and software from the CD and now it works.
For Mediasource. It appears something was corrupted in Mediasource or there is a conflict within the system.Please uninstall all software and drivers for the soundcard, from add/remove programs. Once this is done, shut down the system and changePCI slots for the soundcard, then turn the system back on, cancel the found new hardware wizard, disable all background applications (especially virus scanner, firewall, and any other background applications running in the bottom right hand corner of the system), andthen perform a full reinstallation of the drivers and software from the soundcard installation cd.
CAT I hope you fix your sound card. Good luck. -
Select records based on first n distinct values of column
I need to write a query in plsql to select records for first 3 distinct values of a single column (below example, ID )and all the rows for next 3 distinct values of the column and so on till the end of count of distinct values of a column.
eg:
ID name age
1 abc 10
1 def 20
2 ghi 10
2 jkl 20
2 mno 60
3 pqr 10
4 rst 10
4 tuv 10
5 vwx 10
6 xyz 10
6 hij 10
7 lmn 10
so on... (till some count)
Result should be
Query 1 should result --->
ID name age
1 abc 10
1 def 20
2 ghi 10
2 jkl 20
2 mno 60
3 pqr 10
query 2 should result -->
4 rst 10
4 tuv 10
5 vwx 10
6 xyz 10
6 hij 10
query 3 should result -->
7 lmn 10
9 .. ..
so on..
How to write a query for this inside a loop.Hi,
So, one group will consist of the lowest id value, the 2nd lowest and the 3rd lowest, reggardless of how many rows are involved. The next group will consist of the 4th lowest id, the 5th lowest and the 6th lowest. To do that, you need to assign numbers 1, 2, 3, 4, 5, 6, ... to the rows in order by id, with all rows having the same id getting the same number, and without skipping any numbers.
That sounds like a job for the analytic DENSE_RANK function:
WITH got_grp_id AS
SELECT id, name, age
, CEIL ( DENSE_RANK () OVER (ORDER BY id)
/ 3
) AS grp_id
FROM table_x
SELECT id, name, age
FROM got_grp_id
WHERE id = 1 -- or whatever number you want
;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
See the forum FAQ {message:id=9360002} -
Select records based on criteria and update those records once read
hi,
I am very new to bpel and DB adapters.
I have a requirement where in I need to query two tables to fetch some records and update these selected records with a new value for field to indicate that bpel has processed these records.
Once I select these I needs the output to be mapped to the output variable.
I am able to select the records based on criteria , but how will i lock these records so that these records do not get processed again. This should be a very simple usecase just that I am not aware.
Thanks,
RobinOnce you have finished reading the records fire an update query , update some field in the table so that it does not get picked up next time.
if you are using polling for picking up the records, then use logical delete scenario, refer....http://docs.oracle.com/cd/E15523_01/integration.1111/e10231/adptr_db.htm#BABEEBIH -
Select records based on monthly anniversary date
Hi,
I have a table with a date_added field and I want to select records based on the monthly anniversary date of this field.
eg. ID, Date_added
1, 10-DEC-2012
2, 11-NOV-2012
3, 10-MAR-2012
4, 28-FEB-2012
5, 30-DEC-2012
So For the 10th of Jan 2013, I would want to return records 1 and 3 only
I started looking at the extract function, but this soon falls down for records at the end of the month. For example, on the 28th Feb, I would also want to include records where the date_added day is the 29th, 30th or 31st. So, in the table above I would want to return records 4 and 5, but extract would only return 4.
Is there a simple function to do this month anniversary query - am I missing something very obvious? Or, do I need to write a query to explicitly cope with dates at the end of the month? So far I haven't found a sensible simple solution!
I'm using 11g
thanksI didn't look into leap year, but this should give you a starting point:
select *
from t
where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
when to_date(:target_date,'mmddyyyy')
then case
when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
then 1
end
else case
when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
then 1
end
end
/For example, target date is 1/10/2013:
SQL> variable target_date varchar2(8)
SQL> exec :target_date := '01102013';
PL/SQL procedure successfully completed.
SQL> with t as (
2 select 1 id,to_date('10-DEC-2012','dd-mon-yyyy') date_added from dual union all
3 select 2,to_date('11-NOV-2012','dd-mon-yyyy') from dual union all
4 select 3,to_date('10-MAR-2012','dd-mon-yyyy') from dual union all
5 select 4,to_date('28-FEB-2012','dd-mon-yyyy') from dual union all
6 select 5,to_date('30-DEC-2012','dd-mon-yyyy') from dual
7 )
8 select *
9 from t
10 where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
11 when to_date(:target_date,'mmddyyyy')
12 then case
13 when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
14 then 1
15 end
16 else case
17 when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
18 then 1
19 end
20 end
21 /
ID DATE_ADDE
1 10-DEC-12
3 10-MAR-12
SQL> And target date is 2/28/2013:
SQL> exec :target_date := '02282013';
PL/SQL procedure successfully completed.
SQL> with t as (
2 select 1 id,to_date('10-DEC-2012','dd-mon-yyyy') date_added from dual union all
3 select 2,to_date('11-NOV-2012','dd-mon-yyyy') from dual union all
4 select 3,to_date('10-MAR-2012','dd-mon-yyyy') from dual union all
5 select 4,to_date('28-FEB-2012','dd-mon-yyyy') from dual union all
6 select 5,to_date('30-DEC-2012','dd-mon-yyyy') from dual
7 )
8 select *
9 from t
10 where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
11 when to_date(:target_date,'mmddyyyy')
12 then case
13 when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
14 then 1
15 end
16 else case
17 when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
18 then 1
19 end
20 end
21 /
ID DATE_ADDE
4 28-FEB-12
5 30-DEC-12
SQL> SY.
Maybe you are looking for
-
How i fix the error 1015 for my iphone3g coz my phone i opining
how i fix the error 1015 for my iphone3g coz my phone i opining and also i can use since i face that problem
-
Hello is it possible to assign two terms of payment for a single vendor for a single purchase org if yes how is it maina
-
How do I add place names to events in iPhoto 11
How do I add place names to events iPhoto 11 version 9.2.1, I can do a single picture at a time but when you have a 100 or so it's going to get tedius. I have found messages via google that tell me how to do it but it dos'nt work. I select the event
-
How can I write a read a data on a SmartCArd
Hi everyone... I would like to know. how I can write and read a data on a SmartCard maybe through a file(IO) could you helpme please?? Thanks a lot... Marcos
-
I really need help with this. If I open a jpg in PS6 and crop it, the file transforms from a locked background layer to Layer 0 which is not locked. Then if I want to Save as a jpg I must flatten the layers as it is now a PSD file. SO frustrated! Any