Regarding query Help
Hi all,
Message was edited by:
user586
Do you have a specific question, something you're hung up on, a particular section where you need help? Or are you just hoping someone will do your work for you (kinda what it seems from what i read).
If you wrote the PL/SQL, and now you have to modify it for new requirements, i'd say you'te the best person to do the work.
Similar Messages
-
Regarding Query/Where box in oracle forms
Hi,
I have a query regarding query/where box in oracle.
When I enter ":" in one of the field query box pops up and when I enter some query and press F12 to execute query.
The OK button has to be pressed twice to retrieve the result.
Can anyone please let me know why this is happening, instead of retreiving results at one go by pressing OK once.
When does query box pos up? I have to avoid hitting OK button on query box twice.
Thanks for your advice in advance.
Thanks,
KLC
Edited by: user5411765 on Nov 22, 2010 10:44 PMHi,
Were you able to get around this problem? I am facing the same and need help! :(
Regards,
Arun -
hii
i need a query help
i have two tables
the 1st table will look like this
associate id weekid no.of. hours
4000 810 40
4000 820 30
4000 830 60
4000 840 70
2nd table will look like this
associate id weekid no.of.hours
4000 810 40
4000 820 70
4000 830 130
4000 840 200
so when i subtract the last two records frm each other in the second table the value should be equal to the no.of.hours in the first table.. for example
the query shud consider the last record and one before the last record and the difference between two records shud be equal to the value in the 1st table
for example
consider week id 830 and 840
in second table 830=130
840=200
when u subtraced both values the difference shud be equal to value in the 1st table for tht week id
1 ---->>>> 840 - 830
=200 - 130
=70
in first table 840 has 70 hrs
like this it shud check with all records and it shud return only the records which are not equal
regards
srikanthThis..?
sql>select * from t1;
A_ID W_ID HRS
4000 810 40
4000 820 30
4000 830 60
4000 840 70
4000 850 80
sql>select * from t2;
A_ID W_ID HRS
4000 810 40
4000 820 70
4000 830 130
4000 840 200
4000 850 260
sql>
select a_id,w_id,hrs,sum_hrs
from(
select t1.a_id a_id,t1.w_id w_id,t1.hrs hrs,t2.hrs sum_hrs,
t2.hrs - nvl(lag(t2.hrs) over(order by t1.w_id),0) diff
from t1,t2
where t1.w_id = t2.w_id)
where diff != hrs;
A_ID W_ID HRS SUM_HRS
4000 850 80 260 -
Query Help:
http://forum.java.sun.com/thread.jsp?forum=45&thread=471180&tstart=15&trange=15
It seems I have confused enough people with my improper presentation of query. Sorry guys. I will restate my question with different table names.
The above was my previous posting, which was not clear..so Iam restating my problem as follows....
I have the following tables
Customer(custID, Name, Address)
Order(custID, OrderID, orderDate)
CreditCard(custID, creditCard#, creditCardType)
Now if I have 3 records in Order with custID 100 and 2 records in CreditCard as
Order:
100,A001,11/22/03
100,A002,11/24/03
100,A003,12/02/03
CreditCard:
100,42323232..., VISA
100,5234234...., MASTER
Now how can I get
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
data in minimum no. of records....
I think I have made my query clear..
now please help me guys...
thanks so much for your help.You are right.
But frankly the actual tables on my database are not customer,orders and creditcards..but I just tried to reproduce the problem with these tables, please ignore that user needs a refund etc situtaion. If the tables were actually order,creditcards etc..it would have been a problem to be considered.
Can you please help me with the query
if I have m rows in Order and n rows in CreditCard. I will get m*n records, I looking for max(m,n).
With the following fields in my query result,
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
from Customer, Order, CreditCard tables
Thanks so much for your htlp -
SQL Query Help - Is this possible or impossible????
Hi guys,
I need help with an SQL query that I'm trying to develop. It's very easy to explain but when trying to implement it, I'm struggling to achieve the results that I want.....
For example,
I have 2 tables
The first table is:
1) COMPANY create table company (manufacturer varchar2(25),
date_established date,
location varchar2(25) );My sample test date is:
insert into company values ('Ford', 1902, 'USA');
insert into company values ('BMW', 1910, 'Germany');
insert into company values ('Tata', 1922, 'India');The second table is:
2) MODELS create table models (manufacturer varchar(25),
model varchar2(25),
price number(10),
year date,
current_production_status varchar2(1) ) ;My sample test data is:
insert into models values ('Ford', 'Mondeo', 10000, 2010, 0);
insert into models values ('Ford', 'Galaxy', 12000, 2008, 0);
insert into models values ('Ford', 'Escort', 10000, 1992, 1);
insert into models values ('BMW', '318', 17500, 2010, 0);
insert into models values ('BMW', '535d', 32000, 2006, 0);
insert into models values ('BMW', 'Z4', 10000, 1992, 0);
insert into models values ('Tata', 'Safari', 4000, 1999, 0);
insert into models values ('Tata', 'Sumo', 5500, 1996, 1);
insert into models values ('Tata', 'Maruti', 3500, 1998, 0);And this is my query:
SELECT
com.manufacturer,
com.date_established,
com.location,
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
mod.current_production_status
FROM
company com,
models mod
WHERE
mod.manufacturer = com.manufacturer
and com.manufacturer IN ('Ford', 'BMW', 'Tata')
and mod.current_production_status IN (1,0)
ORDER BY
mod.current_production_status DESCWhat I want the query to output is this:
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
BMW 1910 Germany - - - 0
Tata 1922 India Sumo 5500 1998 1If current_production_status is 1 it means this particular model has been discontinued
If current_production_status is 0 it means the manufacturer does not have any discontinued models and all are in procuction.
The rule is only one record per manufacturer is allowed to have a current_production_status of 1 (so only one model from the selection the manufactuer offers is allowed to be discontinued).
So the query should output the one row where current_production_status is 1 for each manufacturer.
If for a given manufacturer there are no discontinued models and all have a current_production_status of 0 then ouput a SINGLE row that only includes the data from the COMPANY table (as above). The rest of the columns from the MODELS table should be populated with a '-' (hyphen).
My query as it is above will output all the records where current status is 1 or 0 like this
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
Tata 1922 India Sumo 5500 1998 1
Ford 1902 USA - - - 0
Ford 1902 USA - - - 0
BMW 1910 Germany - - - 0
BMW 1910 Germany - - - 0
BMW 1910 Germany - - - 0
Tata 1922 India - - - 0
Tata 1922 India - - - 0However this is not what I want.
Any ideas how I can achieve the result I need?
Thanks!
P.S. Database version is '10.2.0.1.0'Hi Vishnu,
Karthiks query helped...
But this is the problem I am facing...
SELECT
com.manufacturer,
com.date_established,
com.location,
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
mod.current_production_status
FROM
company com,
models mod
WHERE
mod.manufacturer = com.manufacturer
and com.manufacturer = 'Ford'
and mod.current_production_status IN (1,0)
ORDER BY
mod.current_production_status DESCThe value of:
and com.manufacturer = 'Ford'will be dependent on front end user input....
When I run the query above I get all the rows where current_production_status is either 1 or 0.
I only require the rows where current_production_status is 1.
So if I amend it to look like this:
and mod.current_production_status = 1This works....
BUT if a user now passes in more than one manufacturer EG:
and com.manufacturer IN ('Ford', 'BMW')The query will only return the one row for Ford where current_production_status is 1. However because BMW has no models where current_production_status is 1 (all 3 are 0), I still want this to be output - as one row....
So like this:
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
BMW 1910 Germany - - - 0So (hopefully you understand), I want both cases to be catered for.....whether a user enters one manufacturer or more than one...
Thanks you so much!
This is really driving me insane :-( -
Hi Experts,
I need your help in solving a query about F4 help. I would like to know whether it is possible to return more than one column value from a F4 help. I am working on a scenario where, consider i have a table control with 3 columns. I have F4 helps for two columns. The third column which does not have the F4 help is the primary key and the two columns which have F4 help has repeated values. Consider the following values in the F4 help internal table.
ColumnA ColumnB ColumnC
1 01 10.09.2009
2 01 10.09.2009
3 01 10.09.2009
Now consider the user selects first row '10.09.2009' in ColumnC and selects '01' from first row columnB from F4 help. I need to populate '1' in columnA of table control. For this i am using read statement in PBO of my screen. But the read statement fails since ColumnB and ColumnC have repeated values. Kindly provide a solution to fix this problem. Is it possible to get the row id of the row selected by the user from F4 help? I am using the Fm F4IF_INT_TABLE_VALUE_REQUEST. This Fm returns a return_tab. The return_tab has a field record_pos which is 001 always. So it is of no use. Pls help me with a proper suggestion.
Regards
Rohanhi
if u want an f4 help and get the other values in the row u need to write the code in process on values request.
in PVR
GET CURSOR LINE LINE.
IF TC-TOP_LINE > 1.
LINE = LINE + ( TC-TOP_LINE - 1 ).
ENDIF.
read table itab index line.
in that itab u will get the values . -
Help regarding Query Browser in Xcelsius
Till now I have been practicing dashboards using spreadsheet as Data Source. But here our consultants have used the BEx query as the data source, which I could n't practice as because i do not have login id and password which is required to "Add Query' in the Xcelsius. Please find the below attached image file and please help in making understand what exactly have they done using the 'Query Browser'.
Would be more thankful, if anyone can make me understand the Concepts of 'Result Objects', Filters and Prompts.
The Drill Down of the First Query i.e.HC_FTE_HC_A_Payscaletype
--Regards
RanendraHi Ranendra,
The only difference is till now u r working on offline data and with these Query Browser you have started working with live data.
Even though you get this live data you have to work on excel as u must dump the data to excelsheet.
Now we discuss the use of Query Browser:
Query browser is a new option we have in current version of Dashboard, we use this to connect
to
1) BeX queries through BICS connection
2) Unx universes which are created in IDT.
Your requirement falls under 1st category
There are few steps which you have to consider before going to result set designing, filters and prompts.
First we have to establish a connection which acts as an interface betwen your BeX query and dashboard and we do that by creating a BICS connection in the IDT.
Just create a BICS connection and this should be exported to repositiry.
Only after this you can access the connection through Query Browser in dashboards.
Now coming to result sets, these are actually your Query. Here you drag the desired dimension objects and measure objects.
Filters: If you want restrict your data, then we use filter. Drag the object in the filter pane.
Prompt: If you want user to make the selection of the parameter then u declare a prompt.
For indetail information about the other properties please go through the Suman description.
Regards,
Anjani Kumar C.A. -
Urgent..help regarding query
can anyone tell me what this code does..
REPORT Z_SD_Q_03 MESSAGE-ID Z_SD.
PROGRAMA : Z_SD_Q_03
FECHA : 12-07-1999
AUTOR : MADASV
DESCRIPCION : Ejecutar query 03(SD)
VARIABLES
DATA: WERKS LIKE LIKP-WERKS,
NOMBRE_REPORT LIKE AQADEF-PGNAME.
RANGES
RANGES CENTRO FOR LIKP-WERKS.
CONSTANTS
CONSTANTS: QUERY LIKE AQADEF-QUNAME VALUE '03',
USERGROUP LIKE AQADEF-BGNAME VALUE 'SD'.
START-OF-SELECTION
START-OF-SELECTION.
Centro
GET PARAMETER ID 'WR1' FIELD WERKS.
CENTRO-LOW = WERKS.
CENTRO-SIGN = 'I'.
CENTRO-OPTION = 'EQ'.
APPEND CENTRO.
CALL FUNCTION 'RSAQ_EXIST_QUERY'
EXPORTING
WORKSPACE = ' '
USERGROUP = USERGROUP
QUERY = QUERY
IMPORTING
REPORTNAME = NOMBRE_REPORT
EXCEPTIONS
NO_USERGROUP = 1
NO_QUERY = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE E100 WITH QUERY SY-MANDT.
ELSE.
SUBMIT (NOMBRE_REPORT)
WITH OFICI IN CENTRO
WITH SP$00001-LOW = SY-DATUM
VIA SELECTION-SCREEN.
ENDIF.it's checking display authorization of plant WR1 for current user .
Reward if useful
Regards
ANUPAM -
Query regarding F4 help on a field in Selection Screen.
Hi all,
I am trying to attach a F4 help on a field in Selection Screen.
The code fragment I wrote for this purpose is:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR m_cbu.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'CBU_MANAGER'
PVALKEY = ' '
DYNPPROG = sy-cprog
DYNPNR = sy-dynnr
DYNPROFIELD = 'M_CBU'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = 'F'
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
tables
value_tab = tb_cbu_m
FIELD_TAB =
RETURN_TAB = t_return
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Still, I am unable to get any F4 help?
Please point out the mistake..
Thanks in advance.Hi Thien,
My entire code is as follows-
TYPES:
BEGIN OF cbu_m,
cbu_manager TYPE uname,
END OF cbu_m.
DATA:
tb_cbu_m TYPE TABLE OF cbu_m,
wa_cbu_m TYPE cbu_m.
wa_cbu_m-cbu_manager = '123'.
APPEND wa_cbu_m TO tb_cbu_m.
wa_cbu_m-cbu_manager = '234'.
APPEND wa_cbu_m TO tb_cbu_m.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR m_cbu.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'CBU_MANAGER'
PVALKEY = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'M_CBU'
STEPL = 0
WINDOW_TITLE = 'ABC'
VALUE = ' '
value_org = 'S'
MULTIPLE_CHOICE = ' '
display = 'F'
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
value_tab = tb_cbu_m
FIELD_TAB =
return_tab = t_return
DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Here I am getting the same message "No Values Found"..
Please point out the mistake in my code. -
Regarding query...help me
Hi,
i have some problem with the following query
update interface.home_equity set heloc_convert_to_perm_find
=(select flag_value
from bravura.mtg_chars
where
mtg_chars.mtg_rev_number=0
and mtg_chars.mtg_sk_seq=home_equity.mtg_sk_seq
and mtg_chars.flag_typr='ctp'
and mtg_chars.mtg_chars_rev_num=0
and mtg_chars.flag_value='y'
and mtg_chars.exp_date is null)
where exists
(select 'x' from bravura.mtg_chars
where
home_equity.mtg_sk_seq=mtg_chars.mtg_sk_seq)
The problem is it is returning multiple rows, as i was updating a row in a table, it should return one row.
(The main flow is " There is one main database (lets take 'A' for example) and there is another database (take as 'B'). B is for datawarehousing, what ever the data is there in A, it should come 2 B)
please see the query and tell me the answer as quickly as possible.( answer in the sense., where will be the fault)
thanks in advanceWhat result do you get from this query?
select home_equity.mtg_sk_seq, count(mtg_chars.flag_value)
from bravura.mtg_chars, interface.home_equity
where
mtg_chars.mtg_rev_number=0
and mtg_chars.mtg_sk_seq=home_equity.mtg_sk_seq
and mtg_chars.flag_typr='ctp'
and mtg_chars.mtg_chars_rev_num=0
and mtg_chars.flag_value='y'
and mtg_chars.exp_date is null
group by home_equity.mtg_sk_seq
having count(mtg_chars.flag_value > 1
/Cheers, APC -
Need query help regarding employee retirement age.
Need query to find employee retirement age 2years in advance.
You can use per_all_people_f table.
something like this :-
SELECT PAPF.employee_number,
PAPF.date_of_birth,
(MONTHS_BETWEEN(SYSDATE,PAPF.date_of_birth) / 12)+2 RETIREMENT_AGE_FIGURE
FROM per_all_people_f PAPF
WHERE TRUNC (SYSDATE) BETWEEN PAPF.effective_Start_date AND PAPF.effective_end_date
AND (MONTHS_BETWEEN(SYSDATE,date_of_birth) / 12)+2 >=65 /* ASSUMING 65 IS RETIREMENT AGE HERE*/
In case if you only want to pick Employee data then use below sample query and modify according to your requirement :-
SELECT PAPF.employee_number,
PAPF.date_of_birth,
((MONTHS_BETWEEN(SYSDATE,PAPF.date_of_birth) / 12)+2) RETIREMENT_AGE_FIGURE,
PPT.system_person_type,
PPT.user_person_type
FROM per_all_people_f PAPF,
per_person_types PPT,
per_person_type_usages_f PPTUF
WHERE TRUNC (SYSDATE) BETWEEN PAPF.effective_Start_date AND PAPF.effective_end_date
AND ((MONTHS_BETWEEN(SYSDATE,date_of_birth) / 12)+2) >=65
AND PPTUF.person_id = PAPF.person_id
AND PPT.person_type_id = PPTUF.person_type_id
AND PPT.system_person_type = 'EMP'
AND TRUNC (SYSDATE) BETWEEN PPTUF.effective_Start_date AND PPTUF.effective_end_date
Edited by: VISHAL DANGI on Jul 8, 2012 10:30 PM -
*** Help needed regarding Query ***
Hi,
I have the following input parameters as follows
in_col ( can have values as col1, col2, col3)
in_val
now i have the following requirement
select a,b
from tbl
where
<if in_col = col1 then tbl.a>
<if in_col = col2 then tbl.b>
<if in_col = col3 then tbl.c> -- tbl.c can have null values in the DB
IN
<if in_val = '*' and in_col = col3 then ('monday','tuesday',null) >
<else in_val >
-- That is the person can select a criteria ( in_col) which indicates a column name and also value for it ( in_val).
Now if he selects col1 or col2 then its a direct comparison with the in_val ( ie something like 'where column name = value' [ even the column name is dynamic here] )
but if he selects col3 and if in_value is any value other than '*' then also it will be a direct comparison ('where column name = value' ). But if he select col3 and in_value as '*' then the where clause should be like 'where tbl.C IN ('monday','tuesday',null) as col3 can contain null values also ( its like selecting all the rows(*) for col3)
Hope u r not confused...
Looking for a solution from you !!
SI think of something like
where case in_col
when 'col1' then a
when 'col2' then b
when 'col3' then nvl(c, 'null')
end
=
case in_val
when '*' then case in_col
when 'col3' then case c
when 'monday' then 'monday'
when 'tuesday' then 'tuesday'
when 'null' then 'null'
else 'xxxxxx'
end
end
else in_val
end
not tested, neither syntactically, nor logically, nor in terms of performance!!
Regards,
Gerd -
Hi,
I have created a view for the employee table and i am trying to fetch the list of employees who are not managers.
Below is the query which i was trying to use.
select emp_id from v_emp where emp_id not in (select distinct mgr_id from v_emp);
but this query is not returning any results. also I tried
select emp_id from v_emp where emp_id not in (select mgr_id from v_emp);
This query also does not return any values. So i tried writing the query using not exists which seems to be working fine.
select emp_id from v_emp a where not exists(select 1 from v_emp b where b.mgr_id=a.emp_id);
This seems to be working. It seems to be problem when the oracle is doing the query_rewrite. because when i tried to change the execution plan by giving a condition inside it seems to be working fine.
select emp_id from v_emp where emp_id not in(select mgr_id from v_emp where rownum>0)
this seems to be working fine.
Could you please let me know what exactly will be creating this issue, I tried for to check whether any duplicate exists in the view(Ideally it should not be). But could not find any thing.Thanks, mgr_id is not null for any employees, but I got the value when i gave the condition rownum>1 it is working fine. Could it be the problem with index or some duplication in base table for view.
Edited by: user575682 on Oct 5, 2009 12:34 PM -
dear all,
i am working with JDBC and Access database. I have a table name FilingTable and it has 6 column: title, mdate, tdate, place, content and person. the UI has a jdbtable where it shows all the data from the database. there are six textfield where i can give value seach for perticular row consisting this value. the quirement is : I may give a parameter, two parameter and may be six parameter the search will show the rows containing those value or closely similar to those value. I need help from you.
zakirHello,
Try SQL with the LIKE condition to perform your search and % as wildcards.
LIKE will however not find similar matches but only exact matches.
Hope this helps
Niklas -
I have 2 tables student and student_subject
TABLE: STUDENT
STUDENT_SEQ|ID
1|I1
2|I2
3|I3
4|I4TABLE: SUB_CLASS
SUB_CLASS|STUDENT_SEQ
SUB1|1
SUB2|1
SUB3|2
SUB1|3
SUB3|4I want to retreive only STUDENTS who have been enrolled to both SUB1 and SUB2.
Edited by: vamsikrishnagorantla on Dec 27, 2010 4:08 PMwith t1 as (
select 1 student_seq,'I1' id from dual union all
select 2,'I2' from dual union all
select 3,'I3' from dual union all
select 4,'I4' from dual
t2 as (
select 'SUB1' sub_class,1 student_seq from dual union all
select 'SUB2',1 from dual union all
select 'SUB3',2 from dual union all
select 'SUB1',3 from dual union all
select 'SUB3',4 from dual
select t1.student_seq,
id
from t1
where 2 = (
select count(distinct sub_class)
from t2
where sub_class in (
'SUB1',
'SUB2'
and t2.student_seq = t1.student_seq
STUDENT_SEQ ID
1 I1
SQL> SY.
Maybe you are looking for
-
Video quality changes when imported into Final Cut Pro
I have video files that I have imported from an external hard drive that were transferred from an HD camera. When viewing the footage directly from the hard drive, the quality is great. Once imported into Final Cut Pro, however, there are small "flar
-
Inheritance not working..
Hi! I would like to clean my code.. There are several connection classes, which all have the same methods. so, inheritance is the choice. for e.g., all my classes start with and use "initWithDelegate". now, my new parent connection class holds this m
-
My "recently added" playist appears in my Itunes but NOT my Ipod touch
I have not changed any of my setting and my "recently added" playist will not appear on my Ipod even though I have re-synched it. Any thoughts on how to get it back on the Ipod?
-
Problem with PDF/X-1a export in illustrator CS6
I have these huge illustrator files containing a mix of text, vector shapes and placed bitmap pictures cropped using clipping masks. When I used to save as a PDF/X-1a:2001 in Illustrator CS3, the clipping masks were applied and only the visible pixel
-
Searching for ipod without computer
i need help find my ipod touch. i have lost it