How to query a row based on its rownum
Dear all,
what is the easiest way to query a row based on its rownum? Suppose I have the following query:
select first_name from employees where rownum<5;
FIRST_NAME
Ellen
Sundar
Mozhe
DavidSo Ellen has rownum 1, Sundar 2 and so on. How can I do it if I just want to query a row where Mozhe is the first_name, which is rownum 3?
Best regards,
Val
JS1 wrote:
Valerie Debonair wrote:
I was thinking how oracle assign a rownum in a table is by how it populates the rows in the table.Hence a statement "based on its availability". Maybe my way of thinking it's not accurate?
You are correct, your way of thinking is wholly innaccurate. Something that can easily be confirmed simply by reading the documentation:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns009.htm#i1006297
okie doke... thanks for the correction
Similar Messages
-
How to suppress a row based on current date - at query level?
In an Bex query report i have suppress rows based on current date.
There is no current date available in query.
there is a date field in the query.
If by chance the date in that field is lesser than current date, I have to suppress that row.
How can this be achieved?What is the code ofr creating a variable to get values >= to current date?
I have implemented the following code which is not working.
data L_S_range like line of E_T_range[].
CLEAR L_S_RANGE.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'GE'.
L_S_RANGE-LOW = SY-DATUM.
APPEND L_S_RANGE TO E_T_RANGE[].
Actually i have written in class, which will be inherited in superclass.
Edited by: akshara20 on Feb 2, 2011 1:21 PM -
How to get current row(Based on Radio button check) submit button Click
Hi i hava Query Region Search(Based On Auto Customization Criteria).
For Showing Results iam Using Table Region.
Using Radio button How we get the row reference value using Submit button Click.
Please Help on this .
Thanks & Regards
SanHi san ,
Try this
if ("EventID".equals(pageContext.getParameter(EVENT_PARAM)))
String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
OARow row = (OARow)am.findRowByRef(rowRef);
VORowImpl lineRow = (YourVORowImpl)findRowByRef(rowRef); // Replace your vo name .
Please refer this link , Let me know if its not clear .
Single Selection in table Region in OAF .
Keerthi -
How not show duplicate rows based on one field
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
Hello
I have a query that looks for certain scripts that did not run on a particular day compared to what ran the same day a week ago. We want to include the start_datetime and end_datetime but when I add it to the select statement it brings up all instances of the jobs that run multiple times during the day. Is there a way to exclude the extra rows based on the script_name field?
SELECT instances.script_name,
instances.instance_name,
REGEXP_REPLACE(master.description,
chr(49814), -- em-dash
'-') description
--instances.start_datetime
FROM xxcar.xxcar_abat_instances Instances,
xxcar.xxcar_abatch_master Master
WHERE 1 = 1
AND TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
AND Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
MINUS
SELECT script_name,
instance_name,
NULL
--NULL
FROM xxcar.xxcar_abat_instances
WHERE 1 = 1
AND TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))MINUS does a set operation - removing rows from the first set that exactly match the second set.
When you add columns to the first set, you want a more restricted filtering - try a multi-column NOT IN:
To remove multiple runs, group and get min/max
SELECT instances.script_name,
instances.instance_name,
REGEXP_REPLACE(master.description,
chr(49814), -- em-dash
'-') description,
min(instances.start_datetime) start_datetime,
min(instances.end_datetime) end_datetime
FROM xxcar.xxcar_abat_instances Instances,
xxcar.xxcar_abatch_master Master
WHERE 1 = 1
AND TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
AND Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
AND (script_name, instance_name) NOT IN
( SELECT script_name,
instance_name
FROM xxcar.xxcar_abat_instances
WHERE 1 = 1
AND TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))
group by instances.script_name, instances.instance_name, master.descriptionYou didn't give table definitions, and the query has schemas in it, so I didn't test it.
regards,
David -
How to query the rows of a ViewObject programatically?
Hi All,
I'm using View Objects(based on a SQL query) as part of my ADF form. At present my VO contains about 2500 rows. I need to programatically query these 2500 rows of the ViewObject for a particular row.
I'd like to know the best approach to do this.
At present, I am looping around the VO using a for loop, and getting RowAtRange(Index i) and checking each row. I know this is not the best way forward and would like to use any native VO/ADF methods to do this.
I'm not sure if getRowMatch is applicable?
UsingJDev : 11.1.1.4
Thanks
PP.You can use findByKey method, check this
http://baigsorcl.blogspot.com/2010/03/adf-how-to-find-rows-in-iterator.html -
How to retrieving latest row based on a column value
Hi,
Lets consider a scenario. I have a table which has a order number, count column which is our fact, a type column which contains types e.g. (A,B) with A has more priority then B. Now in our graph we are getting all rows i.e. if we have two rows in db for order #1 one for type A and one for type B, then it shows us data from both rows in graph.
But I need only to show one row of type A in this case as A has higher priority than B. The row with type B should not contribute in construction of my graph if type A for same row also exists.
I tried a solution, for which i created a new column at logical level which contain 1 for A and 0 for B. Now i put Max aggregation rule in it to get maximum value which will be row with Type A in our case. But it did not work.
How we will can achieve it in OBIEE?
Thanks.
Aasim Khan.Hi Steve,
I have a similar requirement... one of the columns in my table is a calculated value based on several xml fields,
<?xdofx:(MATH01+MATH02+MATH03+MATH04+MATH05+AA+AA1)+((FNDCD01+FNDCD02+FNDCD03+FNDCD04+FNDCD05+MCHCD01+MCHCD02) div '8')?>
if the resultant value above is less than 62, i do no want to display this entire row in the output. could you help me wout with this?
thanks
Domnic -
How to send a Row based in a view Object
Hi,
i has in the app module a method to insert but i want from the baking bean send a Row with the information but not function well
---this is my method in the app module
public boolean CreaCliente1(Row row){
ViewObjectImpl vo =this.getClientesVo();
vo.insertRow(row);
this.getDBTransaction().commit();
return true
in the bean the the method where i asign the data to the object row is
public Row CreaCliente(Row row){
SimuladorAppImpl app = new SimuladorAppImpl();
ViewObjectImpl vo = app.getClientesVo();
Row row = vo.createRow();
row.setAttribute("IdCliente",0);
row.setAttribute("NuDocumento",this.getNumeroDocumento());
row.setAttribute("IdTipoDocumento",1);
row.setAttribute("CaPrimerNombre", this.getPrimerNombre());
row.setAttribute("CaSegundoNombre",this.getSegundoNombre());
row.setAttribute("CaPrimerApellido",this.getPrimerApellido());
row.setAttribute("CaSegundoApellido", this.getSegundoApellido());
row.setAttribute("CaDireccion",this.getDireccion());
row.setAttribute("CaTelefono",this.getTelefono());
row.setAttribute("CaCorreoElectronico", this.getCorreoElectronico());
row.setAttribute("IdCiudad",11);
row.setAttribute("IdDepto",11001);
row.setAttribute("FeFechaCreacion", new java.sql.Timestamp(new java.util.Date().getTime()));
then i invok the method with the command button but apers a error
how is the best way to do this
thansk
Edited by: JuanAndresDeveloper on 10-feb-2009 8:05You can't just simply create a new application module like that:
SimuladorAppImpl app = new SimuladorAppImpl();This will not work!
An other thing to mention is that you don't push Row objects from the view controller to the server side (this breaks the MVC paradigm).
If you have to create a new row, you can create a method in your application module and call this method either with a number of attributes or a POJO object holding the values.
Remember too that your new row normally have a primary key attribute which you have to fill with a distinct value for each row.
To get the application module from within a backing bean you can look at ADFUtils.getApplicationModuleForDataControl("YourAppModuleDataControl");Search the FOD application for the ADFUtils class or this forum.
Timo -
How to exclude entire row based on single column
Hello there,
I'm trying to hide an entire row if column does not equal 'E' and can't seem to get it to work. Here is code i am using inside the group:
<?for-each:current-group()?>
<?if@row:recordType != 'E'?><?end if?>
<?end for-each:current-group?>
What am i missing? Also note that the column i am trying to filter on is in the xml but not being displayed in the report.
Edited by: [email protected] on Mar 30, 2010 3:05 PMHi Steve,
I have a similar requirement... one of the columns in my table is a calculated value based on several xml fields,
<?xdofx:(MATH01+MATH02+MATH03+MATH04+MATH05+AA+AA1)+((FNDCD01+FNDCD02+FNDCD03+FNDCD04+FNDCD05+MCHCD01+MCHCD02) div '8')?>
if the resultant value above is less than 62, i do no want to display this entire row in the output. could you help me wout with this?
thanks
Domnic -
How to look for bundle based on its content (actions)?
Hello,
I want to have a list of all bundles that use a specific system variable, for exemple ${NSSREPO}.
It is possible to make an SQL query to do it or do you know a way to get such list?
I do not want to export all bundles on XML files and then look for the string.
Thanks in advance.micgra,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Visit http://www.novell.com/support and search the knowledgebase and/or check all
the other self support options and support programs available.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.novell.com)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.novell.com/faq.php
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Forums Team
http://forums.novell.com -
How to find the linkname based on its ractangle?- indesign cs2- js?
i selected the rectangle , which holding one image init, i cant able to get the image name, how to solve this in indesign cs2?
-thanks
subhamyRect.graphics[0].itemLink.name;
-
Query - restricting rows based on specific combinations of columns
I have two columns in two different tables T1 and T2 like below
T1.Column1 T2.Column2
1 a
2 b
3 c
4 d
5 e
I need all the combinations of values in the columns, which I can choose like
select T1.Column1, T2.Column2 from T1, T2 ------ (Without specifying any join ie. cartesian product)
But, in those, combinations, I need to restrict the following combinations, from not being selected - (1,b), (1,c),(3,b), in the same sql, or using a subquery. I am not able to achieve this after several attempts. Can any one help?Just pad it and check
SQL> select no,name from a,b where to_char(no)||name not in ('1b','1c','3b')
2 /
NO N
1 a
1 d
1 e
2 a
2 b
2 c
2 d
2 e
3 a
3 c
3 d
NO N
3 e
4 a
4 b
4 c
4 d
4 e
5 a
5 b
5 c
5 d
5 eThanks,
Karthick. -
How can i update rows in a table based on a match from a select query
Hello
How can i update rows in a table based on a match from a select query fron two other tables with a update using sqlplus ?
Thanks Glenn
table1
attribute1 varchar2 (10)
attribute2 varchar2 (10)
processed varchar2 (10)
table2
attribute1 varchar2 (10)
table3
attribute2 varchar2 (10)
An example:
set table1.processed = "Y"
where (table1.attribute1 = table2.attribute1)
and (table1.attribute2 = table3.attribute2)Hi,
Etbin wrote:
Hi, Frank
taking nulls into account, what if some attributes are null ;) then the query should look like
NOT TESTED !
update table1 t1
set processed = 'Y'
where exists(select null
from table2
where lnnvl(attribute1 != t1.attribute1)
and exists(select null
from table3
where lnnvl(attribute2 != t1.attribute2)
and processed != 'Y'Regards
EtbinYes, you could do that. OP specifically requested something else:
wgdoig wrote:
set table1.processed = "Y"
where (table1.attribute1 = table2.attribute1)
and (table1.attribute2 = table3.attribute2)This WHERE clause won't be TRUE if any of the 4 attribute columns are NULL. It's debatable about what should be done when those columns are NULL.
But there is no argument about what needs to be done when processed is NULL.
OP didn't specifically say that the UPDATEshould or shouldn't be done on rows where processed was already 'Y'. You (quite rightly) introduced a condition that would prevent redo from being generated and triggers from firing unnecessarily; I'm just saying that we have to be careful that the same condition doesn't keep the row from being UPDATEd when it is necessary. -
How to display first row value returened from a query as checked as default in a report
How to display first row value returned from a query as checked as default in a report
Example
Parameter 1
Paramerter2
ABD
x(checked)
Test
DEF
JMG
MudassarHi Mudassar,
The issue is caused by the order in which the parameters appear in the report data tab can be difference between our report execution and it failing. In other words, “Parameter2” is execution before parameter “A” due to this issue. We can adjust the parameter’s
order to solve the issue.
If “Parameter2” is parameter “A”, we cannot use that expression. Because fields cannot be used in report parameter expression, if we want to display the first value returned from a query as default value, we have to fill the “Specify values” text box with
the specific value in Default Values dialog box.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
How to Fix the row in sap script, its urgent......
Hi Experts,
first i explain my sap script, i have print void check in my script client give readymade format means box are there, lines are there. i have to fix in box and line data form database table. everthing is working fine. i got all data. i have total 6 window in my script .but i have one issue In my sap script in header window total five rows... like below
Check voucher no:8888
check No: 1234
Date:1/28/2007
Bank:xyz
Batch no: 5678
now sometime check voucher is balnk....
Check voucher no: BLANK/NULL
check No: 1234
Date:1/28/2007
Bank:xyz
Batch no: 5678
because of that all rows are move up side and all window also move up side and so script not fix to the box and line all data are seen not perfectly... so guru`s how to fix the row and window in script....
its urgent...
Waiting for ur reply
Thanks & regards
JigarHi,
Follow the below steps . Definately your issue will bve resolved.
Let us suppose you are printing following fields
PH &v_text&
PH &v_text1&
PH &v_text2&
you will get the output as you expected.
and if you have any conditions for these fileds
/: if v_text is not initial.
PH &v_text&
/: endif
PH &v_text1&
PH &v_text2&
if you have data in each field then you will get output as expected .
But when v_text is initial.
the data will be moved up wnhich is happening in your case.
so what you need to do is?
/: if v_text is not initial.
PH &v_text&
/: else
PH (Here you need to mention empty line with same paragraph format
/: endif.
PH &v_text1&
PH &v_text2&
Reward points if useful
Regards,
Nageswar -
How to create an LOV based on a dynamic query
Hi,
Can someone tell me how to query a dynamic query for LOV. On my base page I have a dropdown-box (that will show the table names for searching) and is dynamically populated based on users access e.g. if user A logs in he may see 5 values (these values are basically table names) in a drop down if user B logs in he may see 10 values. I also have two input fields one field a user can enter value and the other field is read only and a torch icon for LOV so the user can search and select values that are populated in the input fields on the base page.
How can I have my LOV that takes in a value selected in the dropdown and anyvalue entered in one of the input fields and search in the table selected in the dropdown box.
Basically my LOV should do a search on the table and some search value passed when clicking on the torch icon. So a user can select any table-name in the drop down and my LOV should do a search only on the selected table. Once on the LOV Popup want to have a search field there but it only searched on the table selected in the dropdown on the based page. And the selected value on the LOV Popup page gets populated in fields on the base page.
Any help is appreciated.
ThanksHi,
I have created 4 SQL Based VO's with the following sqls
SELECT header_id AS ID, to_char(order_number) AS NAME
FROM oe_order_headers_all
SELECT party_id AS ID, party_name AS NAME
FROM hz_parties
SELECT quote_header_id AS ID,
(quote_number || CHR (45) || quote_version) AS NAME
FROM aso_quote_headers
SELECT sales_lead_id AS ID, to_char(lead_number) AS NAME
FROM as_sales_leadsI created on LOVRegin and have the following 2 messagestyle items now what do I set in the ViewInstance and View Attribute fields
srcid
srcname
Can you provide some sample code to set ViewUsage and whereclause that I need to put in the controller of LOVRegion.
Thanks
Maybe you are looking for
-
Cant connect wirelessly to internet after installing iphoto 9.2.1
I recently upgraede my system to 10.6.8. Today I downloaded and installed iPhoto 9.2.1 (going from 6.0.6). Now I cant connect to the internet wirelessly. Ethernet works. Could these actions have something to do with causing this problem?
-
I think this is so bad on Apple's part. I just bought Final Cut Studio, and now they release Final Cut Pro X. Apple keeps a veil of secrecy about the release of their products, but if I had known Final Cut Pro X would have integrated the main Final C
-
IPhone 3G intermittently not compatible with Apple Dock / Component Video
I purchased a new Apple Dock and Component Video cable for my 3G. Both original Apple parts. On the first day it all worked perfectly. Now it seems I have a 50/50 chance of getting the "this device not compatible with iPhone - switch to airplane mode
-
Wired dot1X session termination
Hi all, Question about wired dot1X session termination. After a client successfully done on the wired dot1x authentication, my authZ rule is follow by the VLAN assignement whereby DHCP server will provision a client IP to the PC. But when the client
-
Which is the best way to migrate the SQL SERVER 2000 Database to SQL SERVER 2003 Database?
Hi, I need to migrate the Production database sql server 2000 to Sql server 2003, Please give me the best idea to migrate the database without any loss data, credentials and Objects. Nandha Kumar