Using pop-up value in select statement
Hello.
I want to select a value from a pop-up box and then use that value in a select statement for another pop-up. Is that possible?
The first pop-up is P39_PIIN_CALL but it is not recognized in the second pop-up when I use it in the select statemnt... select * from table where PIIN = :P39_PIIN_CALL. I get nothing back because it has no idea what :P39_PIIN_CALL is. I'm desperate and on a timeline.
Thanks,
Mark E
Hi,
After fetching the value from first popup the page should submit so that the value is availble to the second popup..
Edit the first popup.. and in HTML Form Element Attributes and enter onchange="doSubmit('MyRequest')"
Regards,
Shijesh
Similar Messages
-
Limitations in using a function within a select statement
I have a function which retrieves various data elements from the
database and formats it accordingly. The data (varchar2)
returned could be in excess of 2,000 characters length.
I need to use the returned data as part of a view. I am able to
use the function in a "select" statement, but when I use it with
returned data in excess of 2,000 chars, I get the following
error:
ORA-06502: PL/SQL: numeric or value error
This error is occurring whenever the returned data is in excess
of 2,000 characters.
Is there an alternative method to what I am proposing, I have
tried alternative data types but if I am able to use it in a
"select" statement, I get the above error when the returned
length exceeds 2,000 chars.
Thanks
Peterare u using oracle 7. varchar2 limit in 8 is 4000.
-
Use of cursors insted of select statements
could any one please explain what is the advantage of using cursors instead of simple select statements
thanks
sibyA benefit to using an explicit cursor rather than a select statement, is for the NO_DATA_FOUND exception. Its kind of like a free IF statment. IF no data is found, then stop.
if you write a select statement, and no data is returned, you SHOULD code for the NO_DATA_FOUND exception. Often people say, "i'll ALWAYS get a row returned". but you should always cover your code "just in case". so you must code an exception...
declare
v_var varchar2(1);
procedure do_something(p_parm varchar2) is
begin
null;
end do_something;
procedure log_error is
begin
null;
end log_error;
begin <<main>>
do_something('x');
begin <<selectblock>>
select dummy
into v_var
from dual
where dummy = 'a';
do_something(v_var);
exception
when no_data_found then
log_error;
end selectblock;
do_something (v_var||'abc');
end main;
if you use an explicit cursor instead, you don't need to code for the NO_DATA_FOUND. If an explicit cursor opens and finds no rows, there are simply no rows. of course, you don't need a loop if you expect only 1 row returned under normal circumstances.
BTW, don' forget that SQL%ROWCOUNT and your_cursor%ROWCOUNT are not initialized. There is a null, until a row is successfully fetched. therefore if no rows are returned at all, %ROWCOUNT is NULL.
declare
v_var varchar2(1);
cursor my_cur is
select dummy
from dual
where dummy = 'a';
procedure do_something(p_parm varchar2) is
begin
null;
end do_something;
procedure log_error is
begin
null;
end log_error;
begin << main>>
for cur_rec in my_cur loop
dbms_output.put_line('inside');
begin <<loop_block>>
if nvl(my_cur%rowcount,0) > 1 then
do_something(cur_rec.dummy);
else
log_error;
end if;
end loop_block;
end loop;
end main;
/ -
How to use Oracle Table Type values in Select Statement.
Hi,
I am fetching initial set of values into Oracle Table of Records Type and want to use list of values in the Select statement.
For example, try something like the following:
TYPE t_record IS RECORD (
ID TABLEA.ID%type,
NO TABLEA.NO%type,
v_record t_record;
TYPE t_table IS TABLE OF v_record%TYPE;
v_table t_table;
-- Code to populate the values in v_table here.
SELEC ID,NO, BULK COLLECT INTO <some other table variabes here> FROM TABLEA
WHERE ID IN v_table(i).ID;
I want to know how to use the values from Oracle Table Type in the Select Statement.Something like this:
create or replace type t_record as object (
id number,
no number
CREATE or replace type t_table AS TABLE OF t_record;
set serveroutput on
declare
v_table t_table := t_table();
v_t1 t_table := t_table();
begin
v_table.extend(1);
v_table(1).ID := 1;
v_table(1).No := 10;
v_table.extend(1);
v_table(2).ID := 2;
v_table(2).ID := 20;
SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
from TableA
FROM TABLEA
WHERE ID IN (select t.ID from table(v_Table) t);
for i in 1..v_t1.count loop
dbms_output.put_line(v_t1(i).ID);
dbms_output.put_line(v_t1(i).No);
end loop;
end;
/Untested!
P;
Edited by: bluefrog on Mar 5, 2010 5:08 PM -
Problem - Creating a Dynamic LOV using duplicate value in select statement
I am trying to create a Dynamic LOV by attempting to follow a pattern similar to the following:
select shop_name d, shop_id r
from shops
order by 1
However, I want to use the shop_name twice as in the following because I do not have any other unique identifier available such as a shop_id to associate with the shop name:
select shop_name d, shop_name r
from shops
order by 1
But I get an error where I am not allowed to duplicate the shop_name in the select statement. I read somewhere on this forum where it can be done but I can't find exactly how.
Can someone tell or show me how to accomplish this?
Thanks in anticipation for your answer.
Thanks,
RicRic,
I just tried to do this on APEX 3.0, and it worked just fine with this SQL:
select ename d, ename r from emp order by 1Perhaps you could put an example on apex.oracle.com or specify the error message that you're getting.
So as long as you have uniquely aliased both columns, this should not present a problem.
Thanks,
- Scott - -
How to use variables in an sql select statement.
Hi, I have seen examples using the update, but nothing using a select statement.
I have four variables I am getting from drop down menus in my JSP I set the user selected items to strings.
How would I create the select statement like this:
.String XName = request.getParameter("UserInputX");
rsInResult = stmtInResult.executeQuery("SELECT ColumxX FROM TableZ WHERE ColumnX = XName")Obviously it tries to read "XName" as a column and of course can't find it, how would I set it up to have it see the Value of XName and not the literal XName.read this:
rsInResult = stmtInResult.executeQuery("SELECT ColumxX FROM TableZ WHERE ColumnX = '"+XName+"')
{code}
better way is PreparedStatement:
{code}
// example code to change password to an user in the USERS table
String newPWD = "my password";
String user = "luxjava";
PreparedStatement prepStat;
String updatePWD = "UPDATE LOGISTIC.USERS "+
"SET logistic.users.password = ? "+
"WHERE logistic.users.username = ?";
prepStat = ql.conDb.prepareStatement(updatePWD);
prepStat.setString(1, newPwd);
prepStat.setString(2, user);
int zeroNotFound = prepStat.executeUpdate();
if (zeroNotFound==0)
ql.conDb.rollback();
prepStat.close();
else
ql.conDb.commit();
prepStat.close();
{code}
... use the SQLException to capture errors -
How to ask user to enter value in select statement
Hi,
Can anyone tell me syntax of select statement where i can ask user to enter value .
for example i am trying to use belowthing but it displaying error
select * from emp where empname=:empname
SP2-0552: Bind variable "empname" not declared.
2.Is there any data dictionary table to see all pl/sql procedures and corresponding code?
Thanks,
sriuser632733 wrote:
Can anyone tell me syntax of select statement where i can ask user to enter value .None. The SQL engine resides on the server. It is incapable of prompting for data entry on the client.
The client interacts with the user. The client is suppose to:
a) prompt for variable values
b) send a SQL statement to Oracle
c) bind values to bind variables in the SQL statement
for example i am trying to use belowthing but it displaying error
select * from emp where empname=:empnameIn SQL*Plus, you need to create a bind variable:
SQL> var empname varchar2(200)
And then assign a value to it:
SQL> exec :empname := 'John Doe';
Note that this is still not ideal - as the assignment is also done via the server and sends a PL block to the server. This block contains non-sharable code and this can lead to fragmentation of the server's Shared Pool.
But it does illustrate the basic principle. -
Can we use is null in our select statement in ABAP program
hi,
I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data. Can anyone resolve this.Hi,
I think you've posted your question on the wrong forum. This is the SAP Business One development forum which is not part of ERP and doesn't include any ABAP or Netweaver programming.
For a list of forums please see here:
http://forums.sdn.sap.com/index.jspa
Kind Regards,
Owen -
How to pass values in select statement as a parameter?
Hi,
Very simple query, how do I pass the values that i get in the cursor to a select statement. If table1 values are 1,2,3,4 etc , each time the cursor goes through , I will get one value in the variable - Offer
So I want to pass that value to the select statement.. how do i do it?
the one below does not work.
drop table L1;
create table L1
(col1 varchar(300) null) ;
insert into L1 (col1)
select filter_name from table1 ;
SET SERVEROUTPUT ON;
DECLARE
offer table1.col1%TYPE;
factor INTEGER := 0;
CURSOR c1 IS
SELECT col1 FROM table1;
BEGIN
OPEN c1; -- PL/SQL evaluates factor
LOOP
FETCH c1 INTO offer;
EXIT WHEN c1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(offer);
select * from table1 f where f.filter_name =:offer ;
factor := factor + 1;
DBMS_OUTPUT.PUT_LINE(factor);
END LOOP;
CLOSE c1;
END;Hi User,
You are looking somethuing like this, as passing the values to the Cursor as a Paramter.
DECLARE
CURSOR CURR (V_DEPT IN NUMBER) --- Cursor Declaration which accepts the deptno as parameter.
IS
SELECT *
FROM EMP
WHERE DEPTNO = V_DEPT; --- The, Input V_DEPT is passed here.
L_EMP EMP%ROWTYPE;
BEGIN
OPEN CURR (30); -- Opening the Cursor to Process the Value for Department Number 30 and Processing it with a Loop below.
DBMS_OUTPUT.PUT_LINE ('Employee Details for Deptno:30');
LOOP
FETCH CURR INTO L_EMP;
EXIT WHEN CURR%NOTFOUND;
DBMS_OUTPUT.PUT ('EMPNO: ' || L_EMP.EMPNO || ' is ');
DBMS_OUTPUT.PUT_LINE (L_EMP.ENAME);
END LOOP;
CLOSE CURR;
DBMS_OUTPUT.PUT_LINE ('Employee Details for Deptno:20'); -- Opening the Cursor to Process the Value for Department Number 20
OPEN CURR (20);
LOOP
FETCH CURR INTO L_EMP;
EXIT WHEN CURR%NOTFOUND;
DBMS_OUTPUT.PUT ('EMPNO: ' || L_EMP.EMPNO || ' is ');
DBMS_OUTPUT.PUT_LINE (L_EMP.ENAME);
END LOOP;
CLOSE CURR;
END;Thanks,
Shankar -
How to use bind variable in this select statement
Hi,
I have created this procedure where table name and fieldname is variable as they vary, therefore i passed them as parameter. This procedure will trim leading (.) if first five char is '.THE''. The procedure performs the required task. I want to make select statement with bind variable is there any possibility to use a bind variable in this select statement.
the procedure is given below:
create or replace procedure test(tablename in varchar2, fieldname IN varchar2)
authid current_user
is
type poicurtype is ref cursor;
poi_cur poicurtype;
sqlst varchar2(250);
THEVALUE NUMBER;
begin
sqlst:='SELECT EMPNO FROM '||TABLENAME||' WHERE SUBSTR('||FIELDNAME||',1,5)=''.THE ''';
DBMS_OUTPUT.PUT_LINE(SQLST);
OPEN POI_CUR FOR SQLST ;
LOOP
FETCH POI_CUR INTO THEVALUE;
EXIT WHEN POI_CUR%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(THEVALUE);
SQLST:='UPDATE '||TABLENAME|| ' SET '||FIELDNAME||'=LTRIM('||FIELDNAME||',''.'')';
SQLST:=SQLST|| ' WHERE EMPNO=:X';
DBMS_OUTPUT.PUT_LINE(SQLST);
EXECUTE IMMEDIATE SQLST USING THEVALUE;
END LOOP;
COMMIT;
END TEST;
Best Regards,So you want to amend each row individually? Is there some reason you're trying to make this procedure run as slow as possible?
create or replace procedure test (tablename in varchar2, fieldname in varchar2)
authid current_user
is
sqlst varchar2 (250);
thevalue number := 1234;
begin
sqlst := 'update ' || tablename || ' set ' || fieldname || '= ltrim(' || fieldname || ',''.'') where substr(' || fieldname
|| ',1,5) = ''.THE ''';
dbms_output.put_line (sqlst);
execute immediate sqlst;
end test;will update every row that satisfies the criteria in a single statement. If there are 10 rows that start with '.THE ' then it will update 10 rows. -
Problems with Hints in abap code to use an index in a Select statement
Hi,
I want to use an especific index in a select statement but I can´t get it. I use de next statement:
SELECT ltaklgnum ltaktanum ltakvbeln ltaptapos ltapnltyp ltappvqui
FROM ltak AS ltak INNER JOIN ltap AS ltap
ON ltaktanum = ltaptanum
AND ltaklgnum = ltaplgnum
INTO TABLE l_t_tanum_silo
WHERE ltap~lgnum EQ ip_lgnum
AND ltap~pquit EQ ' '
AND ltak~lgnum EQ ip_lgnum
AND ltak~kquit EQ ' '
AND ltak~queue EQ ip_queue
%_HINTS DB2 ''.
We have DB2 for Linux Unix and Windows 9.5 as DB system.
How can I fix this?
Thanks a lot.
RegardsThe DB2 for Linux Unix and Windows is coded DB6 for SAP and not DB2
Look at the following OSS notes
- [Note 129385 - Database hints in Open SQL|https://service.sap.com/sap/support/notes/129385]
- [Note 150037 - Database hints in Open SQL for DB6 (DB2 for LUW)|https://service.sap.com/sap/support/notes/150037]
- [Note 1270314 - DB6: DB2 9.5 Perf. degrad. for queries with INLIST clause|https://service.sap.com/sap/support/notes/1270314]
- [Note 868888 - DB6: Optimization Guidelines|https://service.sap.com/sap/support/notes/868888]
You should use a
SELECT ltak~lgnum ltak~tanum ltak~vbeln ltap~tapos ltap~nltyp ltap~pvqui
FROM ltak AS ltak INNER JOIN ltap AS ltap
ON ltak~tanum = ltap~tanum
AND ltak~lgnum = ltap~lgnum
INTO TABLE l_t_tanum_silo
WHERE ltap~lgnum EQ ip_lgnum
AND ltap~pquit EQ ' '
AND ltak~lgnum EQ ip_lgnum
AND ltak~kquit EQ ' '
AND ltak~queue EQ ip_queue
%_HINTS DB6 '<IXSCAN TABLE=''LTAP'' INDEX=''"LTAP~M"'' />'.
In note 868888 there is a sample for a join.
SELECT A~TABSPACE
FROM TADB6 AS A
JOIN IADB6 AS B ON A~TABART = B~TABART
%_HINTS DB6 '<NLJOIN><IXSCAN TABLE=''IADB6'' />'
DB6 '<IXSCAN TABLE=''TADB6'' /></NLJOIN>'.
Regards -
Can use place holder (?)in select statement.
Is it possible to have have a place holder in my select clause or it is possible to have only in where clause?
Please find the below query I am having place holder in select statement emp_id=? nit it is throwing an error for me.
select * from(select myrows.*, rownum rn from(select acc as account, es as identity,address as street_address
state as stae,select id from mytable where emp_id=? as my site from myview
where ert_id=? and chek=?
I am getting an error ORA-00936: missing expression is it possible to have a place holder in select statement
Please help me on this.
Regards,
BAuser575682 wrote:
Is it possible to have have a place holder in my select clause or it is possible to have only in where clause?
Please find the below query I am having place holder in select statement emp_id=? nit it is throwing an error for me.
select * from(select myrows.*, rownum rn from(select acc as account, es as identity,address as street_address
state as stae,select id from mytable where emp_id=? as my site from myview
where ert_id=? and chek=?
I am getting an error ORA-00936: missing expression is it possible to have a place holder in select statement
Please help me on this.
Regards,
BAfor clarity and easy to be read i attempted to rearrranged your code and this is what it will look like:
select *
from (select myrows.*, rownum rn
from (select acc as account,
es as identity,
address as street_address
state as stae,
select id
from mytable
where emp_id = ? as my site from myview where ert_id=? and chek=?apparently the syntax is not correct and by that you are missing some comma in your column, ? question mark symbol will not be recognize, and some ')' closed parenthesis.
are you using a report builder that you want to use a placeholder column? -
F4 on LIFNR fails to capture the values in SELECT statement
Hi all,
In the last 3 days Ive faced two issues on F4 Helps and its freaking me out.
The first issue I chose to ignore because of time-constraints and able to find a work-around.
On the second issue Ive hit a brick-wall.
Anyways here are my two issues.
Issue I:
I developed a custom report and in that Ive defined a selection-field(among half a dozen others) as follows:
select-options: s_matnr for ekpo-matnr.
On execution when I press F4 on matnr field I get the standard F4 Help. And then when i select the Material I want and hit Enter, the selected value fails to reflect in the Input Screen field. I continues to show blank as if Ive not selected anything. Not surprisingly the Report output was fetching the undesired results.
Later I changed the declared to:
select-options: s_matnr for mara-matnr.
And it worked. However because of time constraints I did not dwelve into it anymore.
This bring me to the Issue II:
For a different Custom Report Ive defined Select_Options on LIFNR as follows:
select-options: s_lifnr for lfa1-lifnr.
Now the issue I face here is slighly different.
On hitting F4 on the LIFNR field Im getting the standard F4 Help, and on selection Im getting the desired Vendor Number on the input screen.
But the problem is while executing the report its not fetching me the records relevant to the selected LIFNR. In debugging it does show me that LIFNR contains the value but surprisingly its not returning any values to the Internal Table.
Im out of ideas at this point of time, trying to figure out whats wrong.
Any ideas on what could be wrong??
pk
PS: Im not using any function modules for the F4 help. Just the straight-forward Standard F4 functionality.>
Eric Cartman wrote:
> I meant here that you can exclude values in select options, for example you told there are 8 items for the vendor in the Z... table, let's say all these 8 items use the same material number, but (whatever reason) this material number is excluded from the selection in s_matnr (it is just an example, there could be many variations, you have a number of select options)
What you say makes sense, but firstly I dont have a MATNR in my table and from the looks of it, its not advisable to use any other common field either. A vendor-wise search is of primary importance in this table. So cant really exclude that.
if Rob's advise was helpful, than it looks like that the domain in the custom table for the field is not lifnr
Well the Domain has always been LIFNR regardless of which Data Element I used.
And the domain should probably be changed, but this might cause compatability issues.
Rob,
What kind of compatibility issues are you talking about? What I have right now is a custom table with some test data. So I guess its ok to change the Domain and Data Elements as I wish and Adjust the Table. Right?
@Amit: I will look at your inputs a little more carefully and get back to you. Right now Im a little tied-up with other issues.
Thanks everyone.
pk
Update:
So... as I said earlier, when I used CONVERSION_EXIT_ALPHA_OUTPUT on LIFNR the selection on LIFNRs worked just fine. But unfortunately the rest of the select-options returned zero results(if I left the LIFNR select-option blank). I found the reason to be that because of the conversion routine the LIFNR values are taken as space. So i guess its looking into the database table for blank values of LIFNR, which is never the case and hence no values returned. Anyways, I found a work-around for this and for the moment its working fine...to some extent.
Only constraint being that I cannot enter a range of values for LIFNR.
Heres the code Im using right now. Thought it might be useful for future references or somebody wants to fine-tune it, is welcome to do so.
if s_lifnr-low = space.
select * from zpst001 into corresponding fields of table ist_zpst001
where tno IN s_tno
and ebelp IN s_ebelp
and pspid IN s_pspid
and werks IN s_werks
and pick IN s_pick
and pstatus IN s_status.
else.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = s_lifnr-low
IMPORTING
OUTPUT = s_lifnr1-low
select * from zpst001 into corresponding fields of table ist_zpst001
where tno IN s_tno
and ebelp IN s_ebelp
and pspid IN s_pspid
and lifnr eq s_lifnr1-low
and werks IN s_werks
and pick IN s_pick
and pstatus IN s_status.
endif.
pk
Edited by: prashanth kishan on Nov 20, 2008 5:08 PM -
Usgent: using jsp date in sql select statement
i have something like this:
String day;
String month;
String year;
select * from event where date = xxx
where xxx is supposed to be obtained from the strings (day, month, year) and changed into a format that can be compared to in the select statement.
what should xxx be?
thks as lot cos i ahe been figuring out for very long.Use PreparedStatement and SimpleDateFormat:
String year = "2002";
String month = "9";
String day = "12";
String sDate = day + "/" + month + "/" + year;
SimpleDateFormat df = new SimpleDateFormat("M/d/yyyy");
Date dDate = df.parse(sDate);
Connection con = DriverManager.getConnection(user, pw);
PreparedStatement ps = con.prepareStatement("SELECT * FROM event WHERE date = ?");
ps.setDate(1, dDate);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
rs.close();
ps.close();
con.close(); -
Using Hint in Update or Select Statement...
Hi ,
I had an update statement that will get the data from the inline select statement,now where can i can keep the hint ,either in update statement or in Select statement...
Please let me know if my sample script is wrong or any better way to approach...Please assume that Salary table had millions of employee's salary records.
update emp
set salary = salary + (select /*+ full(a) parallel(a,4) */ salary from Salary
where experience > 5 and empno = 55 )
where empno = 85Thanks
RedeThe better approach would be to determine why you need a hint in the first place. If you're using a hint, that implies that the optimizer is choosing the incorrect plan when left to its own devices. That, in turn, implies that the statistics on your objects, the statistics on your system, your optimizer parameters, your session's optimizer settings or some other variable is incorrect. You're generally better off fixing the root problem than hinting every query.
In this specific case, the parallel hint is invalid because there is no table aliased A. The full hint is invalid for similar reasons. Plus, with the query you provided, if A was intended to be the SALARY table, it seems exceptionally unlikely that you really want to do a full scan on the salary table to look for what had better be a single row (otherwise your query would throw a "too many rows returned" exception).
Justin
Maybe you are looking for
-
In Design crashes while making interactive pdf
I'm having problems exporting an InDesign file as an interactive .pdf. The file crashes about half way through the document on a specific page number (33). The InDesign file is set up with buttons and bookmarks. I have 4 other files which are differe
-
GTX980 gaming 4G - Display Ports HELP ME PLEASE!!! so stressed
Hi today I bought this video card and 3x Benq XL2430T monitors, nearly $2500 AU dollars worth of gear and all i can do is get 1 friggin screen working via the DVI I am running drivers 344.80 I have installed Benq monitor drivers ALL the monitors show
-
Hello, I have just upgraded to a G5 Dual 1.8. I need to buy wireless keyboard mouse. FCP is my main Application Is there any recommendation regarding a keyboard for this sort of usage? Any links to reviews of such? Thanks!
-
How-To : bapi export table webdynpro bapi import table
Hi folks! This is proving to be very difficult. my appreciation is <b>10 points to the first helpful answer!!</b> I am receiving an export table from one bapi (z_xxx_getlist) into my webdynpro. I want to then import the same table into another bapi (
-
Start deployed applications when J2EE Server starts
Hi experts, This is my problem. I've updated my Netweaver 04s Developer Workplace from SPS1 to SPS10. The problem I have is that when I start my J2EE Server via MMC, the applications (j2ee,ear,webdynpro,...) I deployed don't start. If in my Visual Ad