Doubt in select in to statement
In employees table employee_id first_name last_name are columns.
Written Following pl/sql and it compiles fine
create or replace procedure passEmp(employee_id number,colname varchar2)
as
sname varchar2(50);
begin
select colname into sname from employees where employee_id=100;
dbms_output.put_line(colname ||'value for '||employee_id ||' is '||sname);
end;
When I execute above procedure as
execute passEmp(100,'last_name');
Output is
last_name value for 100 is last_name.
What I am expecting is since I am passing colname as last_name
it should give last_name of employee 100.
Can any one explain why it won't return last_name of employee 100.
When I execute above procedure as
execute passEmp(100,'last_names');---- last_names column is not at all there in table.
Output is
last_names value for 100 is last_names.
Why the procedure is running with out error even when I am passing last_names as
argument which is not existing in table at all....
Hi,
Try this.
create or replace procedure passEmp(employee_id number,colname varchar2)
as
sname varchar2(50);
v_sql varchar2(100);
begin
v_sql := 'select ' || colname || ' from employees where employee_id = '|| employee_id;
execute immediate v_sql into sname;
dbms_output.put_line(colname ||'value for '||employee_id ||' is '||sname);
end;
show errorsIf you want to pass column names or table name at a run time, then normal select won't work.
In that scenario you should use dynamic sql.
Similar Messages
-
I have a doubt in 'SELECT-CASE'. There is this example of which i have :-
SELECT /*+ rule */ SUM(CASE WHEN age <= 15 THEN cnt ELSE 0 END) "upto 15 Years" ,
SUM(CASE WHEN age >= 16 AND age <= 20 THEN cnt ELSE 0 END) "16-20 Years" ,
SUM(CASE WHEN age >= 21 AND age <= 25 THEN cnt ELSE 0 END) "21-25 Years" ,
SUM(CASE WHEN age >= 26 AND age <= 30 THEN cnt ELSE 0 END) "26-30 Years" ,
SUM(CASE WHEN age >= 31 AND age <= 35 THEN cnt ELSE 0 END) "31-35 Years" ,
SUM(CASE WHEN age >= 36 AND age <= 40 THEN cnt ELSE 0 END) "36-40 Years" ,
SUM(CASE WHEN age >= 41 AND age <= 45 THEN cnt ELSE 0 END) "41-45 Years" ,
SUM(CASE WHEN age >= 46 AND age <= 50 THEN cnt ELSE 0 END) "46-50 Years" ,
SUM(CASE WHEN age >= 51 AND age <= 55 THEN cnt ELSE 0 END) "51-55 Years" ,
SUM(CASE WHEN age >= 56 AND age <= 60 THEN cnt ELSE 0 END) "56-60 Years" ,
SUM(CASE WHEN age >= 61 AND age <= 65 THEN cnt ELSE 0 END) "61-65 Years" ,
SUM(CASE WHEN age >= 66 AND age <= 70 THEN cnt ELSE 0 END) "66-70 Years" ,
SUM(CASE WHEN age > 70 THEN cnt ELSE 0 END) ">70 Years"
FROM
(SELECT /*+ rule */ROUND(MONTHS_BETWEEN(SYSDATE,ca.birthdate)/12) age,COUNT(1) cnt
FROM contract_all co , customer_all ca ,curr_co_status curr
WHERE ca.customer_id = co.customer_id
AND co.co_id = curr.co_id
AND curr.ch_status = 'a'
AND ca.birthdate IS NOT NULL
--AND co.co_activated BETWEEN '01-jan-2004' AND '31-dec-2004'
AND EXISTS ( SELECT 'x' FROM hss_cust_segment hcs
WHERE hcs.prgcode = ca.prgcode
AND hcs.description = 'POST')
GROUP BY ROUND(MONTHS_BETWEEN(SYSDATE,ca.birthdate)/12))
In this the statements on top like this-
SUM(CASE WHEN age >= 16 AND age <= 20 THEN cnt ELSE 0 END) "16-20 Years" ,
how does the increment happen in 'THEN cnt' because we are not doing the increment as such using '+1' kind of thing.
I hope, my question is clear. Please help in solving the doubt.
Regards.Sample data, wrong output and desired output please...
I tried with this and it seems right...
WITH ca as (
select to_date('26-9-1990') birthdate from dual union all
select to_date('26-9-1989') birthdate from dual union all
select to_date('26-9-1974') birthdate from dual
SELECT /*+ rule */ SUM(CASE WHEN age <= 15 THEN cnt ELSE 0 END) "upto 15 Years" ,
SUM(CASE WHEN age >= 16 AND age <= 20 THEN cnt ELSE 0 END) "16-20 Years" ,
SUM(CASE WHEN age >= 21 AND age <= 25 THEN cnt ELSE 0 END) "21-25 Years" ,
SUM(CASE WHEN age >= 26 AND age <= 30 THEN cnt ELSE 0 END) "26-30 Years" ,
SUM(CASE WHEN age >= 31 AND age <= 35 THEN cnt ELSE 0 END) "31-35 Years" ,
SUM(CASE WHEN age >= 36 AND age <= 40 THEN cnt ELSE 0 END) "36-40 Years" ,
SUM(CASE WHEN age >= 41 AND age <= 45 THEN cnt ELSE 0 END) "41-45 Years" ,
SUM(CASE WHEN age >= 46 AND age <= 50 THEN cnt ELSE 0 END) "46-50 Years" ,
SUM(CASE WHEN age >= 51 AND age <= 55 THEN cnt ELSE 0 END) "51-55 Years" ,
SUM(CASE WHEN age >= 56 AND age <= 60 THEN cnt ELSE 0 END) "56-60 Years" ,
SUM(CASE WHEN age >= 61 AND age <= 65 THEN cnt ELSE 0 END) "61-65 Years" ,
SUM(CASE WHEN age >= 66 AND age <= 70 THEN cnt ELSE 0 END) "66-70 Years" ,
SUM(CASE WHEN age > 70 THEN cnt ELSE 0 END) ">70 Years"
FROM ( SELECT /*+ rule */ ROUND(MONTHS_BETWEEN(SYSDATE,ca.birthdate)/12) age, COUNT(1) cnt
FROM ca
GROUP BY ROUND(MONTHS_BETWEEN(SYSDATE,ca.birthdate)/12) )
upto 15 Years 16-20 Years 21-25 Years 26-30 Years 31-35 Years 36-40 Years 41-45 Years 46-50 Years 51-55 Years 56-60 Years 61-65 Years 66-70 Years >70 Years
0 2 0 0 1 0 0 0 0 0 0 0 0
1 rows selectedNH. -
Hi i have a doubt in selection screen I had given statement as below now i can see the output screen and i'm getting the output also now i want to know the value of only one vendor. If i had given a vendor number it must select the particular data of that vendor only can u give me any suggestions please
SELECTION-SCREEN BEGIN OF BLOCK P WITH FRAME TITLE TEXT-000.
PARAMETERS: VENDORNO like EKKo-LIFNR,
PURORG like EKKO-EKORG,
PLANT like EKPO-WERKS,
PURDOC like EKKO-BEDAT.
SELECTION-SCREEN END OF BLOCK P.Hi Pavan,
<b>I think this is what u required when u select vendor number automatically for that particular vendor u require values in the remaining 3 parameter fields.
</b>
REPORT zex31 .
PARAMETERS: vendorno LIKE ekko-lifnr,
purorg LIKE ekko-ekorg,
plant LIKE ekpo-werks,
purdoc LIKE ekko-bedat.
DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE.
DATA: return TYPE TABLE OF ddshretval WITH HEADER LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR vendorno.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'EKKO'
fieldname = 'LIFNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'VENDORNO'
TABLES
return_tab = return
EXCEPTIONS
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
OTHERS = 5.
BREAK-POINT.
REFRESH dynfields.
READ TABLE return WITH KEY fieldname = 'VENDORNO'.
Add it back to the dynpro.
dynfields-fieldname = return-retfield.
dynfields-fieldvalue = return-fieldval.
APPEND dynfields.
Get the company code from db and add to dynpro
DATA: xekko TYPE ekko,
xekpo TYPE ekpo.
CLEAR xekko.
CLEAR xekpo.
SELECT SINGLE * INTO xekko
FROM ekko
WHERE lifnr = return-fieldval.
dynfields-fieldname = 'PURORG'.
dynfields-fieldvalue = xekko-ekorg.
APPEND dynfields.
dynfields-fieldname = 'PURDOC'.
dynfields-fieldvalue = xekko-bedat.
APPEND dynfields.
SELECT SINGLE * INTO xekpo
FROM ekpo
WHERE ebeln = xekko-ebeln.
dynfields-fieldname = 'PLANT'.
dynfields-fieldvalue = xekpo-werks.
APPEND dynfields.
Update the dynpro values.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = dynfields
EXCEPTIONS
OTHERS = 8.
START-OF-SELECTION. -
Delete statement that uses a sub-select with the statement in the cursor
Hi all,
How to write write a delete statement that uses a sub-select with the statement in the cursor?
CURSOR excluded_dates IS
SELECT TO_TIMESTAMP(report_parameter_value, in_date_format_mask)
INTO my_current_date_time
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'DATE_TIME'
AND report_parameters.report_parameter_name = 'EXCLUDED_DATE';
OPEN excluded_dates;
LOOP
FETCH excluded_dates INTO my_excluded_date;
EXIT WHEN excluded_dates%NOTFOUND;
DELETE FROM edr_rpt_tmp_inclusion_table
WHERE TO_CHAR(date_time, 'mm/dd/yyyy') = TO_CHAR(my_excluded_date, 'mm/dd/yyyy');
END LOOP;
CLOSE excluded_dates;ThanksHi,
In such case I think is better to create a view an perform the delete using it. Example (using HR schema):
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> create or replace view v_employees as select * from employees where first_name like 'J%';
View created
SQL> select * from v_employees;
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
110 John Chen JCHEN 515.124.4269 28/09/1997 FI_ACCOUNT 8200,00 108 100
112 Jose Manuel Urman JMURMAN 515.124.4469 07/03/1998 FI_ACCOUNT 7800,00 108 100
125 Julia Nayer JNAYER 650.124.1214 16/07/1997 ST_CLERK 3200,00 120 50
127 James Landry JLANDRY 650.124.1334 14/01/1999 ST_CLERK 2400,00 120 50
131 James Marlow JAMRLOW 650.124.7234 16/02/1997 ST_CLERK 2500,00 121 50
133 Jason Mallin JMALLIN 650.127.1934 14/06/1996 ST_CLERK 3300,00 122 50
139 John Seo JSEO 650.121.2019 12/02/1998 ST_CLERK 2700,00 123 50
140 Joshua Patel JPATEL 650.121.1834 06/04/1998 ST_CLERK 2500,00 123 50
145 John Russell JRUSSEL 011.44.1344.429268 01/10/1996 SA_MAN 14000,00 0,40 100 80
156 Janette King JKING 011.44.1345.429268 30/01/1996 SA_REP 10000,00 0,35 146 80
176 Jonathon Taylor JTAYLOR 011.44.1644.429265 24/03/1998 SA_REP 8600,00 0,20 149 80
177 Jack Livingston JLIVINGS 011.44.1644.429264 23/04/1998 SA_REP 8400,00 0,20 149 80
181 Jean Fleaur JFLEAUR 650.507.9877 23/02/1998 SH_CLERK 3100,00 120 50
186 Julia Dellinger JDELLING 650.509.3876 24/06/1998 SH_CLERK 3400,00 121 50
189 Jennifer Dilly JDILLY 650.505.2876 13/08/1997 SH_CLERK 3600,00 122 50
200 Jennifer Whalen JWHALEN 515.123.4444 17/09/1987 AD_ASST 4400,00 101 10
16 rows selected
SQL> delete from v_employees where hire_date >= to_date('01/06/1998', 'dd/mm/yyyy');
2 rows deleted
SQL> regards, -
Can I use a select and update statement in a single jsp file?
I want to update the BUY table everytime I would add a SELL transaction.....I want to minus the stocks that I sold to those that Ive bought before.....
note: I used a seperate table in BUY and SELL transaction
After I Have added a transaction, I want to update the buy table. This is my problem, can I used both SELECT and UPDATE statement at the same time in a single jsp file for example like this:
select * from test, test1;
update test
set total_shares=total_shares-Stotal;
where stock_code=Scode AND name_broker=Sbroker;
Can i have both of these statements in the same jsp file in oder to update the buy table?
Or can anyone suggest how can process that update?THANKS!
--------------------Can i have both of these statements in the same jsp file in oder to update the buy table?Yes. But wouldn't it have been easier just to try it?
-
Hi frnds,
Normally select option allowing only 8 charactor in declaration part, but i want to display with morethan 8 charator. i think some text id formet is there, how to do that.
for ex,
s_org for vbak-vkorg .
for this i want to give sales organisation.
how to do this.
plz its urgent.
GowriSELECTION-SCREEN BEGIN OF LINE.
[SELECTION-SCREEN POSITION pos [ldb_additions]].
SELECTION-SCREEN END OF LINE.
Effect
The first and last statements define a new line below the existing elements on the selection screen.
All the screen elements within these statements that are defined with PARAMETERS SELECT-OPTIONS and SELECTION-SCREEN statements are placed in this line one after the other without spaces.
Several SELECTION-SCREEN POSITION statements can be listed within the definition of a line. The SELECTION-SCREEN POSITION statement can be used to define the output position for the following screen element. The position pos can either be specified directly as a number between 1 and 83 or using pos_low or pos_high expressions. The expression pos_low specifies the position in which the input field for a parameter or the first input field for a selection criterion is displayed as standard. The expression pos_high specifies the position in which the second input field for a selection criterion is to be displayed as standard. If you make a different specification of the position in the statement defining the following element, this is taken into account. The statement SELECTION-SCREEN POSITION is only possible within the definition of a line. If there are conflicts with existing screen elements, the selection screen cannot be generated.
The additions ldb_additions can only be used in a selection include for a logical database.
The following applies in the definition of a line:
Output fields are not created for selection texts for the parameters displayed in these kinds of lines. Instead, these can be created by specifying a SELECTION-SCREEN COMMENT.
You cannot define other lines with SELECTION-SCREEN BEGIN OF LINE.
You cannot define blocks or tabstrip controls with SELECTION-SCREEN BEGIN OF [TABBED] BLOCK.
Within a line, only one selection criteria should be defined with SELECT-OPTIONS whose description can be specified in advance using SELECTION-SCREEN COMMENT. Other combinations, especially definitions of elements according to the selection criteria, can lead to an undefined behaviour.,
The backslash (/) is not allowed when giving format specifications.
You can omit the position specification pos in formatting specifications.
Note
If a screen element is assigned a position greater than 83 or is positioned outside a block with a frame, the selection screen is not generated. In the case of input and output fields that were positioned beforehand but have a length that extends beyond the end of the line, the visible length is shortened accordingly and the content is displayed in the visible length and can be scrolled. In this case, pushbuttons and horizontal lines are cut off at position 83 or where the frame of the block ends.
Example
A pushbutton, an input field, and an output field in a line in the standard selection screen for an executable program.
SELECTION-SCREEN: BEGIN OF LINE,
PUSHBUTTON 2(10) push USER-COMMAND fcode,
POSITION 16.
PARAMETERS para TYPE c LENGTH 20.
SELECTION-SCREEN: COMMENT 40(40) text,
END OF LINE.
INITIALIZATION.
push = 'Push'.
text = '<--- Fill field, then push button!'. -
Hai,
I have problem in my select query,
My previous select query:
SELECT rrcty
ryear
rbukrs
rzzpspid
SUM( hslvt )
SUM( hsl01 )
SUM( hsl02 )
SUM( hsl03 )
SUM( hsl04 )
SUM( hsl05 )
SUM( hsl06 )
SUM( hsl07 )
SUM( hsl08 )
SUM( hsl09 )
SUM( hsl10 )
SUM( hsl11 )
SUM( hsl12 )
SUM( mslvt )
SUM( msl01 )
SUM( msl02 )
SUM( msl03 )
SUM( msl04 )
SUM( msl05 )
SUM( msl06 )
SUM( msl07 )
SUM( msl08 )
SUM( msl09 )
SUM( msl10 )
SUM( msl11 )
SUM( msl12 )
FROM zzsl5t
INTO TABLE it_erbproj
WHERE rldnr EQ c_rldnr AND
rrcty EQ c_rrcty AND
ryear EQ v_srr_fyear AND
rbukrs EQ v_srr_ccode AND
racct EQ v_racct AND
rzzpspid IN r_zzpspid
GROUP BY RRCTY ryear RBUKRS rzzpspid.
now i want change the above select query as,
If user enters input period 03 means,
i have to select
SELECT rrcty
ryear
rbukrs
rzzpspid
SUM( hslvt )
SUM( hsl01 )
SUM( hsl02 )
SUM( hsl03 )
SUM( mslvt )
SUM( msl01 )
SUM( msl02 )
SUM( msl03 )
only, not to select all the periods.
how can i give fields dynamically.
please suggest me.
ElamaranDuplicate message. Please close this one and look at my answer Doubt in Select query.
-
I cannot select a particular state in Fireworks CS6 !
So I've duplicate a state , and after that I tried to change some filters on the newly state , but when I did that it affected the first state too . The problem is that I cannot select a particular state !
Please ,help !I believe this is caused by you working in the background only. You must work in layers for states to be different. Examine my version (in one state I copied the map to a layer, and applied a gaussian blur). Notice that switching to the other state removes that layer, and only displays the background.
http://www.estructor.altervista.org/links/new_version.png -
Audit "SELECT FOR UPDATE" statement
Hi all
My database is 10.2.0.3 and I enabled audit_trail to DB value already.
My purpose I want to audit "SELECT FOR UPDATE" statement on the table and I tried to enable audit "SELECT" on the table that have many records in dba_audit_trail because "SELECT" statement that include in this audit and then I tried to enable audit "LOCK TABLE" on the table that doesn't have any records n dba_audit_trail.
So my question is How to enable audit for collecting only "SELECT FOR UPDATE" statement? or anyone have any idea for this.
Regards,
Hikotaohiko wrote:
Hi all
My database is 10.2.0.3 and I enabled audit_trail to DB value already.
My purpose I want to audit "SELECT FOR UPDATE" statement on the table and I tried to enable audit "SELECT" on the table that have many records in dba_audit_trail because "SELECT" statement that include in this audit and then I tried to enable audit "LOCK TABLE" on the table that doesn't have any records n dba_audit_trail.
So my question is How to enable audit for collecting only "SELECT FOR UPDATE" statement? or anyone have any idea for this.
A consideration on top of the comments made by Justin:
You have an unfortunate version of the database for auditing: when you enable audit on 10.2.0.3 (or.2 or .1) the redo pattern changes - normally you will see a redo change vector for each row updated, but in these versions you will see two records, a "lock row" followed up "update row piece"; which means your volume of redo may increase significantly.
I wrote a note about it some time ago: http://jonathanlewis.wordpress.com/2011/05/27/audit-ouch/ and one of the comments includes the bug number ( 5166745 ), reporting fixed in 10.2.0.4 and 11.1.0.6
Regards
Jonathan Lewis
This is bug -
Insert and select in one statement
using MS Sql server and VB i can execute two queries Insert and select in one statement e.g. (insert into (....) values (...) Select @@Identity).
how can i do the same thing using Oracle and VB. ???
It gives error. here's what i want to do.
(insert into table1 (...) values (...) Select table1_sequence.currval from dual )
KhurramHere's how you can achieve the same Oracle :-
Test Db>desc tmp1;
Name Null? Type
EMP_NO VARCHAR2(10)
EID NUMBER
Test Db>insert into tmp1 (emp_no, eid)
2 select '123', 1
3 from dual;
1 row created.
Shailender Mehta -
Doubt about Select statement.
Hi folks!!
I have a few doubts about the select statements, it may be a silly things but its useful for me.
what is difference between below statment.
1)SELECT * FROM TABLE.
2)SELECT SINGLE * FROM TABLE
3)SELECT SINGLE FROM TABLE.
Hope i will get answer,thanks in advance.
Regards
Richie..Hi,
try this and if possible use sap help.i mean place the cursor on select and press F1.
Types of select statements:
1. select * from ztxlfa1 into table it.
This is simple select statement to fetch all the data of db table into internal table it.
2. select * from ztxlfa1 into table it where lifnr between 'V2' and 'V5'.
Thisis using where condition between v2 and v5.
4. select * from ztxlfa1 where land1 = 'DE'. "row goes into default table work Area
5. select lifnr land1 from ztxlfa1
into corresponding fields of it "notice 'table' is omitted
where land1 = 'DE'.
append it.
endselect.
Now data will go into work area. and then u will add it to internal table by
append statement.
6. Table 13.2 contains a list of the various forms of select as it is used with internal tables and their relative efficiency. They are in descending order of most-to-least efficient.
Table 13.2 Various Forms of SELECT when Filling an Internal Table
Statement(s) Writes To
select into table it Body
select into corresponding fields of table it Body
select into it Header line
select into corresponding fields of it Header line
7. SELECT VBRK~VBELN
VBRK~VKORG
VBRK~FKDAT
VBRK~NETWR
VBRK~WAERK
TVKOT~VTEXT
T001~BUKRS
T001~BUTXT
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
FROM VBRK
INNER JOIN TVKOT ON VBRKVKORG = TVKOTVKORG
INNER JOIN T001 ON VBRKBUKRS = T001BUKRS
WHERE VBELN IN DOCNUM AND VBRK~FKSTO = ''
AND VBRK~FKDAT in date.
Select statement using inner joins for vbrk and t001 and tvkot table for this case based on the conditions
8. SELECT T001W~NAME1 INTO TABLE IT1_T001W
FROM T001W INNER JOIN EKPO ON T001WWERKS = EKPOWERKS
WHERE EKPO~EBELN = PURORD.
here selecting a single field into table it1_t001winner join on ekpo.
9. SELECT BUKRS LIFNR EBELN FROM EKKO INTO CORRESPONDING FIELDS OF IT_EKKO WHERE EBELN IN P_O_NO.
ENDSELECT.
SELECT BUTXT FROM T001 INTO IT_T001 FOR ALL ENTRIES IN IT_EKKO WHERE BUKRS = IT_EKKO-BUKRS.
ENDSELECT.
APPEND IT_T001.
here I am using for all entries statement with select statement. Both joins and for all entries used to fetch the data on condition but for all entries is the best one.
10. SELECT AVBELN BVTEXT AFKDAT CBUTXT ANETWR AWAERK INTO TABLE ITAB
FROM VBRK AS A
INNER JOIN TVKOT AS B ON
AVKORG EQ BVKORG
INNER JOIN T001 AS C ON
ABUKRS EQ CBUKRS
WHERE AVBELN IN BDOCU AND AFKSTO EQ ' ' AND B~SPRAS EQ
SY-LANGU
AND AFKDAT IN BDATE AND AVBELN EQ ANY ( SELECT VBELN FROM
VBRP WHERE VBRP~MATNR EQ ITEMS ).
Here we are using sub query in inner join specified in brackets.
Thanks,
chandu. -
HI Friends,
i have a requirement to select matnr,werks and mmsta from marc table.where i have input of matnr and mmsta.
The matnr in the marc table having 2 werks with different mmsta.
i was asked to select matnr not having mmsta 40.
but in marc table there is same matnr with two mmsta 37 and 40.
i want a select statement which should not pick matnr having 40.
my select statement was
select matnr werks mmsta into itab from marc
where matnr in fpso_matnr and mmsta in fpso_mmsta.
this does not work for the above condition.
please suggest me a correct statement..
Thanks,
Gokulselect matnr werks mmsta into itab from marc
where matnr in fpso_matnr and mmsta in fpso_mmsta
and mmsta NE 40.
ill this not work ?
MARC is plant data.. so I guess u need to give werks also...
Edited by: jackandjay on Dec 19, 2007 12:02 PM -
Simple doubt in select statement
hi all,
Although this is a very simple ques.
Can u pl tell me why i m not getting the value into v_adrnr ?
Chk the following code.
V_VBELN = '0080000001'.
SELECT SINGLE ADRNR
FROM VBPA
INTO V_ADRNR
WHERE VBELN = V_VBELN
AND PARVW = 'BP'.
i have cheked the table vbpa for the above mentioned conditions.I can see the
value for adrnr in database as 0000022741.
But while i run the above code i cant see value on v_adrnr.
Pl help.First PARVW has a domain with a conversion routine based on table TPAUM so "BP" is internal code "RE"
Use CONVERSION_EXIT_PARVW_INPUT
CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
EXPORTING
input = V_PARVW
IMPORTING
output = V_PARVW.
Second
Have you defined V_VBELN with reference to the element VBELN, char 10 with conversion Alpha
Then it should work
Regards -
Hi :
How can i join aufnr , arbei , ismnw since there is no common key field between arbei and aufnr , ismnw.
I am able to join aufnr and ismnw based on aufnr, because im trying to pull data based on aufnr , but when i went to se84 and tried to chk tables for arbei...only one table HIKO has all these fields but there is no data in that.
SELECT aaufnr aauart b~arbei INTO CORRESPONDING FIELDS OF TABLE it_tab
FROM aufk AS a
INNER JOIN plpo AS b ON awerks = bwerks
INNER JOIN iloa AS d ON abukrs = dbukrs
*06/18
INNER JOIN afko AS e ON aaufnr = eaufnr
WHERE a~auart IN s_auart
AND a~auart NE 'PM04'
AND a~auart NE 'PM09'
AND a~werks = 'M600'
AND d~tplnr = 'PB-PRO-S01-BY02-MIL'
AND d~abckz IN s_abckz
AND a~erdat IN s_date.
SELECT SINGLE ismnw INTO v_ismnw FROM afru
WHERE aufnr = v_aufnr.
it_tab-ismnw = v_ismnw.
with my first select statment do i get unique values for arbei?
i would appreciate if any one can help me on this.
Thanks.
RaghuEverybody's question is important.
All you have to do is edit your original question and it will pop to the top.
If you ask the same question twice, somebody may spend a lot of time trying to answer your question only to find that someone else answered it a long time before.
Rob -
Doubt in "Select between" statement
Hi All,
I need to select all the userid's between 'A' to 'Z' ( or 'A* to B' ) ; where 'A' , 'Z*' would be input on the selection screen.
when I tried :
select bname
from user_addr
into <<internal table>>
where bname between 'A' and 'Z'.
It gave me all the user id's starting with 'A*' but didn't proceed further to B,C,D,...Z.
Any possible solution. It is URGENT.
Good reward points would be awarded to correct answers.
Thanks,
Vishal.Check the table contents, this is working for me for any range I give
data i_usr type table of user_addr.
select * into table i_usr from user_addr where
bname between 'A*' and 'F*'.
Maybe you are looking for
-
How can I use a variable as an array's name?
Ok I have several arrays in my code (lets call them "array1", "array2" etc) and I want to load them based on the users input. So if the user enters array1, I want the first array to be loaded, and the same with the other arrays. I tried saving the us
-
Right scenario is probably familiar to most. I have an iTunes Library on a NAS that only does SMB. I can only mount the drive with smb://user:pass@server/share I want to automount the drive using login items Possible? please help rgds timaceuk
-
Hello Guys, I have a situtation as below: User status active : New, RDY, VAL. If I want to install my equipment to FL in SAP, then my user status should be changed to VAL from NEW manually. Because NEW status does not allow me to attach the FL to my
-
Simple question Im sure but Im newbie at this. What is the best way to find the name or IP address of the iSCSI array of my ESX host. The host is not local so I would have to remotely connect. I need it for the Target IP on the iSCSI Initiator on my
-
Iphone 2g wont backup after 3.0 update!
I recently updated to the 3.0 firmware and now every time i try to backup my phone i get the following message Itunes could not back up the iphone "Brandon's Iphone" because the iphone was disconnected. does anyone know what the problem could be? i w