Fetching a value from a select statement inside select clause
hello all,
I have a problem executing a procedure it gives me a runtime error, what am doing is i have multiple select statement inside a select clause. am using the entire select statement for a ref cursor. when running the query seperately am able to get the records but it's not getting compiled.
here is the piece of code which am working with
create or replace procedure cosd_telecommute_procedure
(p_from_date in date,
p_to_date in date,
p_rset in out sys_refcursor)
as
p_str varchar2(10000);
begin
p_str := 'select personnum, '||
'fullname, '||
'personid, '||
'hours, '||
'applydtm, '||
'paycodeid, '||
'laborlev2nm, '||
'laborlev3nm, '||
'laborlev2dsc, '||
'adjdate, '||
'timeshtitemtypeid, '||
'(select max(eff_dt) from cosd_telecommute_info_tbl '||
'where emplid = cosd_vp_telecommute.personnum and '||
'eff_dt between ''01-aug-2005'' and ''30-aug-2005'') thisyreffdt, '||
'(select elig_config7 from cosd_telecommute_info_tbl '||
'where emplid = cosd_vp_telecommute.personnum and '||
'eff_dt = (select max(eff_dt) from cosd_telecommute_info_tbl '||
'where emplid = cosd_vp_telecommute.personnum and '||
'eff_dt between ''01-aug-2005'' and ''30-aug-2005'')) thisyrmiles,'||
'(select max(eff_dt) from cosd_telecommute_info_tbl '||
'where emplid = cosd_vp_telecommute.personnum and '||
'eff_dt between trunc(p_from_date) and trunc(p_to_date)) fiscalyreffdt, '||
'(select elig_config7 from cosd_telecommute_info_tbl '||
'where emplid = cosd_vp_telecommute.personnum and '||
'eff_dt = (select max(eff_dt) from cosd_telecommute_info_tbl '||
'where emplid = cosd_vp_telecommute.personnum and '||
'eff_dt between trunc(p_from_date) and trunc(p_to_date))) fiscalyrmiles '||
'from cosd_vp_telecommute '||
'where trunc(applydtm) '||
'between p_from_date and p_to_date '||
'and personnum = ''029791''';
open p_rset for p_str;
end cosd_telecommute_procedure;
and here is the piece of error am getting
ERROR at line 1:
ORA-00904: invalid column name
ORA-06512: at "TKCSOWNER.COSD_TELECOMMUTE_PROCEDURE", line 40
ORA-06512: at line 5
Did you run the query in SQL plus? Check whether all the column are valid in your database. Below is the query which i got from your procedure just run and check it out. It is really hard for us to tell you the problem without knowing the table structure
select personnum, fullname, personid, hours, applydtm, paycodeid, laborlev2nm, laborlev3nm,
laborlev2dsc, adjdate, timeshtitemtypeid,
(select max(eff_dt) from cosd_telecommute_info_tbl
where emplid = cosd_vp_telecommute.personnum
and eff_dt between '01-aug-2005' and '30-aug-2005') thisyreffdt,
(select elig_config7 from cosd_telecommute_info_tbl where emplid = cosd_vp_telecommute.personnum
and eff_dt = (select max(eff_dt)
from cosd_telecommute_info_tbl
where emplid = cosd_vp_telecommute.personnum
and eff_dt between '01-aug-2005' and '30-aug-2005'
) thisyrmiles,
(select max(eff_dt)
from cosd_telecommute_info_tbl
where emplid = cosd_vp_telecommute.personnum
and eff_dt between trunc(p_from_date) and trunc(p_to_date)
) fiscalyreffdt,
(select elig_config7 from cosd_telecommute_info_tbl where emplid = cosd_vp_telecommute.personnum
and eff_dt = (select max(eff_dt)
from cosd_telecommute_info_tbl
where emplid = cosd_vp_telecommute.personnum
and eff_dt between trunc(p_from_date) and trunc(p_to_date)
) fiscalyrmiles
from cosd_vp_telecommute
where trunc(applydtm) between p_from_date and p_to_date
and personnum = '029791'
Similar Messages
-
Fetch the values from internal table inside an internal table (urgent!!)
data : BEGIN OF PITB2_ZLINFO occurs 0,
BEGDA LIKE SY-DATUM,
ENDDA LIKE SY-DATUM,
PABRJ(4) TYPE N, "Payroll Year
PABRP(2) TYPE N, "Pay. Period
ZL LIKE PC2BF OCCURS 0,
END OF PITB2_ZLINFO.
I have a internal table like this,
How to Fetch the values from internal table inside an internal table.
Kindly Help me on this..
Regards,
Ram.Hi,
Try this....
Loop at PITB2_ZLINF0.
Loop at PITB2_ZLINF0-ZL.
endloop.
Endloop.
Thanks...
Preetham S -
Need help in logic change to avoid select statement inside loop .
Hello all ,
Please see the below code . Here i got the shipment number in internal table IT_VTTK . So For this shipment number i want to get the details from Vekp table in to internal table IT_VEKP . There is no need for me to use For all entries . I have passed the value of it_vekp into work area wa_vekp and getting the details in to IT_vekp using loop.
But since we should not use the select statement inside the loop , Can anybody please tell me how to achieve this functionality .
Instead of passing into work area wa_vttk if i directly use the internal table I'm getting the following error .
"IT_VTTK" is a table without a header line and therefore has no component called "TKNUM".
Hence i have used select statement inside a loop . Please tell me is there any other way to avoid this ?
types:begin of ty_likp,
vbeln type likp-vbeln,
end of ty_likp,
begin of ty_vttk,
tknum type vttk-tknum,
end of ty_vttk.
DATA: IT_VEKP TYPE STANDARD TABLE OF TY_VEKP,
WA_VEKP TYPE TY_VEKP.
data:it_likp type standard table of ty_likp,
wa_likp type ty_likp,
it_likp1 type standard table of ty_likp,
it_vttk type standard table of ty_vttk,
wa_vttk type ty_vttk.
data:w_tknum type vttk-tknum.
if not it_likp is initial .
select vbeln
from
vbfa
into table it_vttk
for all entries in it_likp where vbelv = it_likp-vbeln and vbtyp_n = '8'.
endif .
IF IT_VTTK[] IS NOT INiTIAL.
loop at it_vttk into wa_vttk.
SELECT venum
EXIDV
EXIDV2
BRGEW
NTGEW
GEWEI
TARAG
GEWEI
VHART
INHALT
FROM VEKP INTO TABLE IT_VEKP where VPOBJKEY = wa_vttk-tknum and vpobj = '4'.
endloop.
endif.Hello,
Why would you not like to use FOR ALL ENTRIES in the second select? Is it becasue of the length or type mismatch error between the fields VPOBJKEY and wa_vttk-tknum ?
Vikranth -
From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?
Hi,
Use NVL or COALESCE:
NVL (col_a, col_b)
Returns col_a if col_a is not NULL; otherwise, it returns col_b.
Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Select statements inside a SQL Expression field
Hello
Why cannot we use the Select statements inside a SQL expression field in Crystal Reports ?
Any alternatives for this...
SELECT Top(1) "SomePrivateDatabase"."SPDname" FROM "SomePrivateDatabase"
inner join "Subscriber" on
"Subscriber"."SPDID" = "SomePrivateDatabase"."SPDID"
inner join "UserDetails" on
"UserDetails"."SPDID" = "SubscriberCore"."SPDID"
Regards
Srivatsa
Edited by: Srivatsa Haridas on Dec 3, 2008 12:17 PMHi Srivatsa,
SQL Expressions is something the Database supports. We query the Client engine for a list of functions they make available. If the SQL Statement is not list it's not an option and therefore it won't work.
Your work arounds are to use either a Stored Procedure, this is the most efficient way, all processing is done server side and CR simply waits for the data to format in the report. Another option is to use a
Command Object, use one CO per report so try to get all data within the SQL statement. We simply pass the SQL to the server and wait for the result set, if you get an error it will be the SQL you typed in. Test in a SQL test tool first to confirm you are getting the data correctly.
For more assistance in designing reports please post your report deisgn questions to the Reprot Design forums. I am moving this one to that queue.
Thank you
Don -
Fetching multiple values from XML node
Hi,
I have the below XML string / Data stored in one of a table column. I am trying to extract the values of ITEM_NAME node. using the query :
select extractvalue(xml_data, '/BILL/BILL_DTL/RECORD/ITEM_NAME') from XMLTable;
If i use this query i am getting the error as : ORA-19025 EXTRACTVALUE returns value of only one node
XML String / XML data
<BILL>
.....<BILL_NO>1000</BILL_NO>
.....<SRNO>3456</SRNO>
.....<BILL_DTL>
........<RECORD>
...........<LINE_NO>1</LINE_NO>
...........<ITEM_NAME>TOYOTA COROLLA</ITEM_NAME>
........</RECORD>
........<RECORD>
..........<LINE_NO>2</LINE_NO>
..........<ITEM_NAME>NISSAN CEDRIC</ITEM_NAME>
.......</RECORD>
.....</BILL_DTL>
</BILL>
The structure of the table is given below.
SQL> DESC XMLTABLE;
Column_Name ---------------Type
DOC_ID -------------------------NUMBER
XML_DATA --------------------XMLTYPE
What will be the query to fetch the values from the ITEM_NAME node.
Thanks & RegardsA late answer but just to show that it can be done with XMLTable (the built-in Oracle function) when you expect to return multiple rows from one input.
WITH XMLTable AS
(SELECT XMLTYPE('<BILL>
<BILL_NO>1000</BILL_NO>
<SRNO>3456</SRNO>
<BILL_DTL>
<RECORD>
<LINE_NO>1</LINE_NO>
<ITEM_NAME>TOYOTA COROLLA</ITEM_NAME>
</RECORD>
<RECORD>
<LINE_NO>2</LINE_NO>
<ITEM_NAME>NISSAN CEDRIC</ITEM_NAME>
</RECORD>
</BILL_DTL>
</BILL>') xml_data
FROM dual
SELECT item_name
FROM XMLTable,
XMLTable('/BILL/BILL_DTL/RECORD'
PASSING xml_data
COLUMNS
item_name VARCHAR2(25) PATH 'ITEM_NAME'
Returns
ITEM_NAME
TOYOTA COROLLA
NISSAN CEDRIC -
RE: Getting multiple values from more than one multiple select popup window
I have a button on a JSP of mine that when clicked creates a popup window (right now it is called popup.html) with a multiple select menu.
My question is how do I get all the values selected from the menu into my JSP (sample.jsp) so that I can set each of the values for my bean.
The other problem is that I have more than one select multiple menu.
Please help if you can. Any advice or suggestions here would be greatly appreciated!
Thank you!I realize that I can use request.getParameterValues to get the values selected from my html because I am passing them to the hidden inputs I have and then using the request.getParameterValues to get each of the values.
MY PROBLEM IS WHAT IF I HAVE 4 MULTIPLE SELECTS??? How can I use the same html popup menu to get the values from the 4 different multiple selects????
I look forward to your response.
This code is from my JSP:
<INPUT TYPE="TEXT" NAME="Field1" SIZE="15">
<INPUT TYPE="hidden" name="F1Rad1">
<INPUT TYPE="hidden" name="Permission">
<input type=button name=choice onClick="window.open('optionPicker.html','popuppage','width=250,height=100');" value="Options"></TD>
Here is my optionPicker.html code for the pop up menu:
<html>
<head>
<script language="JavaScript">
function sendValue(s)
var boxSize= s.options[0].value;
var restrict = s.options[1].value;
window.opener.document.addNewForm.F1Rad1.value = boxSize;
window.opener.document.addNewForm.Permission.value = restrict;
window.close();
</script>
</head>
<body>
<center>
<form name=selectform>
<select multiple name=selectmenu size="2">
<option value="large">Large Text Input Area
<option value="restrict">Restricted Access
</select>
<p></p>
<input type=button value="Select Option(s) For Field" onClick="sendValue(this.form.selectmenu);">
</form>
</center>
</body>
</html> -
Select statement inside function with into keyword
Hi Everyone,
i have a function which contains a select statement
create or replace
function fun_1(Table_Name1 in varchar2)
RETURN VARCHAR2
is
VAR_GEN_TYPE NUMBER(10);
TA_U varchar2(256);
VAR_DATA_FLAG varchar2(1);
begin
select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
end
whene ever i am executing this function giving error message: From Keyword Not Found
when i change select statement to
select T.FLAG ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG, VAR_GEN_TYPE from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
then it is working
why first statements will not work ?
i.e.,
select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
why in select statement we cannot use into keyword more than one time ?
Edited by: karteek on Jun 7, 2012 4:23 AM
Edited by: karteek on Jun 7, 2012 4:24 AMselect T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG, from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
into should be only once..
the syntax should be
select <column list>
into
<variable list>
from <table name> where <condition>
--This query shuold return only one row.
column list count and variable list count should match
there should be no comma after last variable.andbefore from. -
APEX - passing values from LOV's or multi-select LOV's to another APEX form
I am new APEX development and I need to take the values from LOV's and multi-select LOV's and pass them to another APEX form. I want to take those passed values and use them in the where clause of the base-table in the called form. Any assistance would be greately appreciated.
Hi,
Refer this example
http://www.talkapex.com/2009/07/apex-how-to-pass-multiselect-list.html
Example: http://apex.oracle.com/pls/otn/f?p=20195:2100
Regards,
Kartik Patel
http://patelkartik.blogspot.com/
http://apex.oracle.com/pls/apex/f?p=9904351712:1 -
[JPA] SELECT NEW inside SELECT NEW in Named Query
Suppose i have two JPA entities Master and Detail as follows:
@Entity
public class Master implements Serializable{
private static final long serialVersionUID = 1L;
private long id;
private String masterField1;
private String masterField2;
private String masterField3;
private String masterField4;
private String masterField5;
//A lot of other fields till masterFieldn...
private String masterFieldn;
private List<Detail> detailList;
//getters and setters here...
@OneToMany(mappedBy = "master", cascade = { CascadeType.ALL }, fetch=FetchType.EAGER)
@OrderBy("detailField1 DESC")
public List<Detail> getDetailList() {
return detailList;
@Entity
public class Detail implements Serializable{
private static final long serialVersionUID = 1L;
private long id;
private String detailField1;
private String detailField2;
private String detailField3;
private String detailField4;
private String detailField5;
//A lot of other fields till detailFieldn...
private String detailFieldn;
private Master master;
//getters and setters here...
@ManyToOne
@JoinColumn(name="MASTER_ID", referencedColumnName="ID") public Master getMaster() {
return master;
}Both Master and Detail entities have a lot of fields, but i only need a subset of those fields when these entities are queried. So, i have two helper classes which i use in named queries in Master JPA entity :
@NamedQueries({
@NamedQuery(name = "Master.findMaster",
query = "SELECT NEW MasterHelper(" +
"t.masterField1, t.masterField2, t.masterField3, " +
" SELECT NEW DetailHelper(" +
"td.detailField1, td.detailField2, td.detailField3 FROM Detail td WHERE " +
" td.master.id = t.id)) FROM Master t WHERE t.id = ?1")MasterHelper and DetailHelper have only the fields i want to query, getters and setters, and a constructor matching the SELECT NEW.. in @NamedQuery :
public class MasterHelper implements java.io.Serializable {
private String field1;
private String field2;
private String field3;
private <DetailHelper> detailList;
//Constructor matching SELECT NEW
public MasterHelper(String field1, String field2, String Field3, List detailList) {
this.field1 = field1;
this.field2 = field2;
this.field3 = field3;
this.detailList = detailList;
//getters and setters
public class DetailHelper implements java.io.Serializable {
private String field1;
private String field2;
private String field3;
//Constructor matching SELECT NEW
public DetailHelper(String field1, String field2, String Field3) {
this.field1 = field1;
this.field2 = field2;
this.field3 = field3;
//getters and setters
}So, basically when i query for a particular Master entity, what i want in return is a List of MasterHelper objects with just the fields i want; each MasterHelper object must include a list of MasterDetail objects, again with just the fields i want.
When the above named query is executed by Toplink Essentials against an Oracle database, i get the following exception regarding the "second" SELECT NEW:
EJBQLException
Exception Description: Syntax error parsing the query [SELECT NEW
...unexpected token [SELECT]
...How can i achieve what i want? Doesn't JPA allows SELECT NEW inside SELECT NEW in named queries?
Thanks in advance for any help.
Edited by: savas_karabuz on May 16, 2008 3:59 AM
Edited by: savas_karabuz on May 16, 2008 4:02 AMHello,
The build you are using is an older one, and there have been a few enhancements done for constructor expressions support (for instance
https://glassfish.dev.java.net/issues/show_bug.cgi?id=1421)
but an enhancement to allow constant values is still open: https://glassfish.dev.java.net/issues/show_bug.cgi?id=2452
Best Regards,
Chris -
How to get the value from a function using a select statement
I have a function(user defined not built in) that returns multiple values(like an array). My question is how do i get those values in a select statement. when i tried to retrieve it,
select pack.my_members from dual;
i am getting an error
ORA-00902: invalid datatype
I am sure this must be a syntax error with the select statement
The following is the function that give the array of data
package pack
package spec
Type my_table is table of varchar2(25);
function the_members
return pack.my_table;
pakcage body
function the_members return pack.my_table
Remarks: This function returns a table containing names of the
members
is
tm pack.my_table:= pack.my_table('first member','second member','third member','fourth member');
begin
return tm;
end the_members;Check this example on Pipelinedfunction
-
Return multiple values from a function to a SELECT statement
I hope I've provided enough information here. If not, just let me know what I'm missing.
I am creating a view that will combine information from a few tables. Most of it is fairly straightforward, but there are a couple of columns in the view that I need to get by running a function within a package. Even this is fairly straightforward (I have a function named action_date in a package called rp, for instance, which I can use to return the date I need via SELECT rp.action_date(sequence_number).
Here's the issue: I actually need to return several bits of information from the same record (not just action_date, but also action_office, action_value, etc.) - a join of the tables won't work here as I'll explain below. I can, of course, run a separate function for each statement but that is obviously inefficient. Within the confines of the view select statement however, I'm not sure how to return each of the values I need.
For instance, right now, I have:
Table1:
sequence_number NUMBER(10),
name VARCHAR(30),
Table2:
Table1_seq NUMBER(10),
action_seq NUMBER(10),
action_date DATE,
action_office VARCHAR(3),
action_value VARCHAR(60),
I can't simply join Table1 and Table2 because I have to do some processing in order to determine which of the matching returned rows I actually need to select. So the package opens a cursor and processes each row until it finds the one that I need.
The following works but is inefficient since all of the calls to the package will return columns from the same record. I just don't know how to return all the values I need into the SELECT statement.
CREATE VIEW all_this_stuff AS
SELECT sequence_number, name,
rp.action_date(sequence_number) action_date,
rp.action_office(sequence_number) action_office,
rp.action_value(sequence_number) action_value
FROM table1
Is there a way to return multiple values into my SELECT statement or am I going about this all wrong?
Any suggestions?
Thanks so much!Hi,
What you want is a Top-N Query , which you can do using the analytic ROW_NUMBER function in a sub-query, like this:
WITH got_rnum AS
SELECT action_seq, action_dt, action_office, action_type, action_value
, ROW_NUMBER () OVER ( ORDER BY action_date
, action_seq
, action_serial
) AS rnum
FROM table2
WHERE action_code = 'AB'
AND action_office LIKE 'E' -- Is this right?
SELECT action_seq, action_dt, action_office, action_type, action_value
FROM got_rnum
WHERE rnum = 1
;As written, this will return (at most) one row.
I suspect you'll really want to get one row for each group , where a group is defined by some value in a table to which you're joining.
In that case, add a PARTITION BY clause to the ROW_NUMBER function.
If you'd post a little sample data (CREATE TABLE and INSERT statements), I could show you exactly how.
Since I don't have your tables, I'll show you using tables in the scott schema.
Here's a view that has data from the scott.dept table and also from scott.emp, but only for the most senior employee in each department (that is, the employee with the earliest hiredate). If there happens to be a tie for the earliest hiredate, then the contender with the lowest empno is chosen.
CREATE OR REPLACE VIEW senior_emp
AS
WITH got_rnum AS
SELECT d.deptno
, d.dname
, e.empno
, e.ename
, e.hiredate
, ROW_NUMBER () OVER ( PARTITION BY d.deptno
ORDER BY e.hiredate
, e.empno
) AS rnum
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
SELECT deptno
, dname
, empno
, ename
, hiredate
FROM got_rnum
WHERE rnum = 1
SELECT *
FROM senior_emp
;Output:
. DEPTNO DNAME EMPNO ENAME HIREDATE
10 ACCOUNTING 7782 CLARK 09-JUN-81
20 RESEARCH 7369 SMITH 17-DEC-80
30 SALES 7499 ALLEN 20-FEB-81
By the way, one of the conditions in the query you posted was
action_office LIKE 'E'which is equivalent to
action_office = 'E'(LIKE is always equivalent to = if the string after LIKE doesn't contain any wildcards.)
Did you mean to say that, or did you mean something like this:
action_office LIKE 'E%'instead? -
Error while fetching the values from database
hiii all,
I have a dynpro project where i am using JDBC codes to fetch data from tables. I have used 2SQL queries...in the first query i am fetching values from 2tables and taking the result from this i run another query.As a result i expect 19591 records as the output....
1)when i put while loop for 19000, 19000records are being within 1min.....
2)when i put while loop for 20000, exception is thrown as :
ArrayIndexOutOfboundsException : size:19591,i:19591
i is variable for while loop
3)when i dont put any condition for while loop, itz taking unlimited time and output is not displayed....
please do help out...group_rs1 = group_st1.executeQuery("SELECT A.JOINT_ID,C.LINE_ID FROM EALPS_DRWREVSPLJTS A,EALPS_DRW_REV_SPL B,EALPS_DRW_REV_LINE C WHERE"
+ " B.SPOOL_ID=A.SPOOL_ID AND B.LINE_ID=C.LINE_ID");
//group_rs1=group_st1.executeQuery("SELECT D.TESTLEVELNO FROM EALPS_EALPS_DRWREVSPLJTS A,WELDTESTCRIT D WHERE D.WELD_TEST_CRIT_ID=A.WELDTEST_CRI_ID ");
//wdComponentAPI.getMessageManager().reportSuccess("connection.toString ="+conn.toString());
int index1=0;
while(group_rs1.next())
arr_joint_id.add((group_rs1.getString(1)));
arr_line_id.add(group_rs1.getString(2));
index1++;
for(int i = 0; i <arr_joint_id.size(); i++)
String joint_id = arr_joint_id.get(i).toString();
group_rs = group_st.executeQuery("SELECT A.SIZE_NBMM,A.ISFIELDJOINT,A.WELDTEST_CRI_ID,D.TESTLEVELNO,E.COMPLETE FROM EALPS_DRWREVSPLJTS A,EALPS_WELDTESTCRIT D,EALPS_ACTV_SEQ E WHERE"
+ " A.JOINT_ID='" + joint_id +"' OR D.WELD_TEST_CRIT_ID=A.WELDTEST_CRI_ID OR E.JOINT_ID=A.JOINT_ID");
int index = 0;
while(group_rs.next())
//wdComponentAPI.getMessageManager().reportSuccess("inside while loop");
arr_size.add(new Float(group_rs.getFloat(1)));
arr_isfieldjoint.add(group_rs.getString(2));
arr_weldtest_cri_id.add(new Long(group_rs.getLong(3)));
arr_testlevelno.add(group_rs.getString(4));
arr_complete.add(group_rs.getString(5));
index++;
thanks a lot for pointing out my mistake that i was taking the last resultset and performing operations on that only....
please go thru my code,i have changed them....now i am taking all the values from each of the record-sets...............but now itz taking infinite time after which the page is exprining....can u plzz suggest............. -
Hi,
I have created a table with 2 LOV's , LOV2 is dependent on LOV2.
Here I can not use the general Dependent LOV concept, as these values are coming from 2 different LookUps.
I am not able to fetch the user input for LOV1 (from page) .that is why not able to set the where cluse fro 2nd LOVVO.
I have used this code:
if ("ViolationCat".equals(lovInputSourceId)) {
OAMessageLovInputBean msglov =
(OAMessageLovInputBean)webBean.findChildRecursive("ViolationCat");
// String p_violation_category = "'"+(String)msglov.getValue(pageContext)+"'";
String p_violation_category =
(String)msglov.getValue(pageContext);
// System.out.println(" p_violation_category =" +
// p_violation_category);
String v_violation_category = "";
//System.out.println("vcat=" + vCat);
OAViewObject violationVO =
(OAViewObject)am.findViewObject("SNI_Violation_DtlsVO2");
Number vcatViolationIdnum =
(Number)violationVO.getCurrentRow().getAttribute("ViolationId");
String vcatViolationId = "" + vcatViolationIdnum;
pageContext.putTransactionValue("vcatViolationId",
vcatViolationId);
pageContext.putTransactionValue("p_violation_category",
p_violation_category);
String query =
" SELECT LOOKUP_CODE, \n" + " MEANING, \n" +
" LOOKUP_TYPE \n" +
" FROM apps.fnd_lookup_values \n" +
" WHERE LOOKUP_TYPE ='SNI_VIOLATION_CATEGORY' AND MEANING=?";
PreparedStatement ps = txn.createPreparedStatement(query, 1);
try {
ps.setString(1, p_violation_category);
ResultSet rs = ps.executeQuery();
//System.out.println("before while,");
// rs.next();
// v_violation_category = rs.getString("LOOKUP_CODE");
// System.out.println("v_violation_category="+v_violation_category);
while (rs.next()) {
//System.out.println("inside while");
v_violation_category = rs.getString("LOOKUP_CODE");
// System.out.println("v_violation_category=" +
// v_violation_category);
ps.close();
} //try ends
catch (Exception e) {
e.getMessage();
//System.out.println("in catch.." + e.getMessage());
OAViewObject subCatVO =
(OAViewObject)am.findViewObject("SNI_ViolationSubCategoryVO1");
//System.out.println("get VO before where clause: subCatVO::"+subCatVO.getQuery());
subCatVO.setWhereClause("LOOKUP_TYPE like '%SNI_VIOL_SUB_CAT_" +
v_violation_category + "'");
System.out.println("after set where clause VO: subCat VO::" +
subCatVO.getQuery());
subCatVO.executeQuery();
// System.out.println("query of subCat VO::" +
// subCatVO.getQuery());
//End of sub category Validation
It is working fine only for the 1st row of teh table.
I have tried to fetch the value using :
String violationCategory = (String)violationVO.getCurrentRow().getAttribute("ViolationCategory");
String violationSubcategory = (String)violationVO.getCurrentRow().getAttribute("ViolationSubcategory");
But it is fetching null value.
Please tell me how can I able to fetch the values.Hi
in your scenarion,first u have to identify the particular row of table where the changes is being made ,u have to use this code .when u select the lov ,first it will give the row refernce and then u have to catch the lov event
OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
String event = pageContext.getParameter("event");
if ("<ItemPPREventName>").equals(event))
// Get the identifier of the PPR event source row
String rowReference =
262
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable[] parameters = { rowReference };
// Pass the rowReference to a "handler" method in the application module.
am.invokeMethod("<handleSomeEvent>", parameters);
In your application module's "handler" method, add the following code to access the source row:
OARow row = (OARow)findRowByRef(rowReference);
if (row != null)
thanx
Pratap -
How to select value from database view with * in wher clause
Hi ,
I ahve a database view with some fields.
Now my requirement is to serach a single row on the basis of process type.
Process type can have values like ZBA,ZBC,ZBD,ZBE or similarly anything starting with ZB.
Now i know that starting two letters will be ZB , but dont knwo the last letter.
So how should i use select query for the same?
Should i use like operator for the same?
regards
PGhi,
u can use character '%'.sample code like this
SELECT reltype
instid_a
catid_a
instid_b
FROM /dbm/ord_docflow
INTO TABLE it_link
FOR ALL ENTRIES IN it_pnwtyh
WHERE instid_a = it_pnwtyh-instid_a AND
instid_b LIKE 'QMSM%' AND
typeid_a = 'BUS2400' AND
typeid_b = 'BUS2400' AND
catid_a = 'BO' AND
catid_b = 'BO' AND
reltype = 'VONA'.
this is similar to using* while we fetch values from table.in the above code only i no QMSM rest values not sure,so used QMSM%
Maybe you are looking for
-
Problem in mapping remoteobject on server side
Hello all I am trying to use remoteobjects in Flex and PHP via Zend_AMF. I am having problem in mapping the data object in flex with the one in PHP. Here's my code.... private function getAuthors(event:Event):void serviceRO = new RemoteObject()
-
Failed to deserialize xml exception
Hey. I have reported a problem that I am getting the following exception when I try to call a web service with my client API built by the Weblogic clientgen task: weblogic.xml.schema.binding.DeserializationException: mapping lookup failure For detail
-
Adobe Dreamweaver CS6 turns off when i lunch it
Hello guys i downloaded Adobe Dreamweaver CS6 when i downloaded it i went on the start menu then all programs then clicked on Adobe Design and Web Premium CS6 then clicked on the Dreamweaver then my computer turned of it self everything else works ap
-
How to Disable Prompt for Command Parameter Vale
I have a CR that uses an SQL Command for the report query. There is a parameter in the Command Where clause like the following: WHERE type = '{?type}' The "type" parameter is also listed in the Command Parameter List. "Type" is also listed as a repo
-
If you closely see ,The Auto scheduling for the ATO Models are not supported by oracle . Once you configure the item using configurator and click on finish ,When it returns to OM ,I expected the Schedule ship dates populated ,But this did not happen