Error in select statement DBIF_RSQL_INVALID RSQL
Hi
Please correct my program I am getting an error when executing
I want min and max value from RECDV (IMRG Table)
please comment it is urgent
REPORT Z_ESLP_MONTHLY_QTY LINE-SIZE 150 LINE-COUNT 75
NO STANDARD PAGE HEADING.
TABLES : equi,
equz,
imptt,
imrg,
eqkt.
Type Declaration
TYPES: BEGIN OF ty_data ,
equnr TYPE equnr, " Euipment no
eqktx TYPE eqkt-eqktx, " Equipment Text
idate type idate, " Measuring Date
recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
recdv type imrg-recdv, " Counter reading data
END OF ty_data.
TYPES: BEGIN OF ty_final,
equnr TYPE equnr, " Equipment no
eqktx TYPE eqkt-eqktx, " Equipment Text
idate type idate, " Measuring Date
recdv type imrg-recdv, " Counter reading data
recdu type imrg-recdu, " unit of measurment KM/L/H
min_km type imrg-recdv, " Min Km
max_km type imrg-recdv, " Max km
t_lit_hr type imrg-recdv, " Total Max - Min = ?
END OF ty_final.
DATA: i_data TYPE TABLE OF ty_data, " internal table
i_final TYPE TABLE OF ty_final, " internal table
wa_data TYPE ty_data, " work area
wa_final TYPE ty_final. " work area
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_equnr FOR equi-equnr no-extension no intervals,
p_idate FOR imrg-idate, "NO-EXTENSION NO INTERVALS OBLIGATORY,
p_recdu FOR imrg-recdu. " NO-EXTENSION NO INTERVALS default 'M3'" OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECTION-SCREEN END OF BLOCK blk2.
SELECTION-SCREEN END OF BLOCK blk.
TOP-OF-PAGE.
FORMAT INTENSIFIED ON.
WRITE:/1(40) ' WAGNERS INVESTMENT LIMITED '.
WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED ,
2 'Page', sy-pagno.
FORMAT INTENSIFIED OFF.
WRITE:/50(40) '----
' CENTERED .
FORMAT INTENSIFIED ON.
WRITE:/2 sy-datum COLOR 3, sy-uzeit .
"WRITE:/1 S903-SPMON ."p_yearf.
ULINE.
"CENTERED.
write: /2 'Period From :' ,p_yearf, ' Period to :' , p_yeart.
write: /2 'Sold to Party :'left-justified,p_kunag-low , ' to ' , p_kunag-high.
write: /2 'Plant :' left-justified , s_werks-low, ' to ' , s_werks-high.
write: /2 'UOM :' left-justified ,s_vrkme-low.
SKIP.
ULINE.
FORMAT COLOR 1.
WRITE:/1 sy-vline,
2 'EQUIP NO', 10 sy-vline,
11 'NAME', 40 sy-vline,
41 'MIN_READ ' CENTERED , 50 sy-vline,
51 'MAX_READ', 58 sy-vline,
59 'TOTAL', 66 sy-vline.
FORMAT COLOR 1 OFF.
ULINE.
END-OF-PAGE.
START-OF-SELECTION.
select cequnr brecdv into table i_data
from imptt AS a
inner join imrg as b
on apoint = bpoint
inner join equi as c
on ampobj = cobjnr
where c~equnr in p_equnr
and
b~idate in p_idate
and
b~recdu in p_recdu.
LOOP AT i_data INTO wa_data.
CLEAR: wa_data.
READ TABLE i_data into wa_data
"READ TABLE i_final INTO wa_final
WITH KEY equnr = wa_data-equnr.
ENDLOOP.
LOOP AT i_final INTO wa_final.
FORMAT COLOR 2 .
WRITE:/1 sy-vline,
2 wa_data-equnr, 10 sy-vline,
11 wa_final-eqktx COLOR 2, 40 sy-vline,
41 wa_final-recdv DECIMALS 1 LEFT-JUSTIFIED, 50 sy-vline,
51 wa_final-recdu LEFT-JUSTIFIED, 58 sy-vline.
uline.
ENDLOOP.
regards
pIROZ
hi
at the place of last query use this one
select cequnr brecdv into corresponding fields of table i_data
from imptt AS a
inner join imrg as b
on apoint = bpoint
inner join equi as c
on ampobj = cobjnr
where c~equnr in p_equnr
and
b~idate in p_idate
and
b~recdu in p_recdu.
reward if useful.
Similar Messages
-
Runtime error at select statement in RFC_READ TABLE FM
Dear All,
I have copied the standard FM RFC_READ_TABLE to incorporate the customer needs. Below is the select query which I have written in this FM.
SELECT (po_search_text-column_text) INTO <wa> FROM ekko
INNER JOIN ekpo ON ekko~ebeln = ekpo~ebeln
INNER JOIN eket ON ekpo~ebeln = eket~ebeln AND ekpo~ebelp = eket~ebelp
INNER JOIN lfa1 ON ekko~lifnr = lfa1~lifnr
INNER JOIN lfm1 ON ekko~lifnr = lfm1~lifnr AND ekko~ekorg = lfm1~ekorg
INNER JOIN lfb1 ON ekko~lifnr = lfb1~lifnr AND ekko~bukrs = lfb1~bukrs
INNER JOIN t024 ON ekko~ekgrp = t024~ekgrp
INNER JOIN zatscsng_status ON eket~ebeln = zatscsng_status~po_number
AND eket~ebelp = zatscsng_status~po_line
AND eket~etenr = zatscsng_status~po_sched_line
INNER JOIN adrc ON zatscsng_status~delivery_addr = adrc~addrnumber
WHERE (po_search_text-cond_text)
ORDER BY (po_search_text-sort_text).
Here, posearch_text-column_text_ will have the fields to be selected at runtime and posearch_text-cond_text_ is the where condition. It is running fine in this case.
But when I try to select Item Category ( EKPO-PSTYP), if data is present for this category, it is returning the values but if data is not there for the particular item category in the where clause, it is giving a RUNTIME ERROR at the select statement.
Here is the ERROR ANALYSIS:
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
not caught in
procedure "ZATSCSNG_RFC_READ_TABLE" "(FUNCTION)", nor was it propagated by a
RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The current ABAP program has tried to execute an Open SQL statement
which contains a WHERE, ON or HAVING condition with a dynamic part.
The part of the WHERE, ON or HAVING condition specified at runtime in
a field or an internal table, contains the invalid value "<L_LINE>-PSTYP".
Edited by: Rob Burbank on Mar 17, 2010 5:09 PMNow that's what I call a join statement...
You probably have a bug in how you build po_search_text-cond_text, the content must be a syntactically correct where clause. It seems that in your example there is just "<L_LINE>-PSTYP" without a condition, so try omitting it altogether.
Debug the content of po_search_text-cond_text before it hits the select statement.
Thomas -
Error in select statement in CMOD
Hi Friends
I am enhancing a data source with some fields and in the CMOD i am writing the code.
My delcaration is as follows
begin of ty_dfkkzp,
SELW2 type dfkkzp-SELW2,
BLART type dfkkzp-BLART ,
BUDAT type dfkkzp-BUDAT ,
BLDAT type dfkkzp-BLDAT ,
TBETR type dfkkzp-TBETR ,
ZZRECEIPT type dfkkzp-ZZRECEIPT ,
ZZPAYCAT type dfkkzp-ZZPAYCAT ,
ZZPAYSRC type dfkkzp-ZZPAYSRC ,
ZZPAYTYPE type dfkkzp-ZZPAYTYPE ,
ZZTENDER type dfkkzp-ZZTENDER ,
end of ty_dfkkzp.
Following is my SELECT statement.
select
SELW2
BLART
BUDAT
BLDAT
TBETR
ZZRECEIPT
ZZPAYCAT
ZZPAYSRC
ZZPAYTYPE
ZZTENDER
into corresponding fields of table lt_dfkkzp
from dfkkzp
for all entries in it_data
where SELW2 = it_data-VTREF.
I am getting an error in the where clause. This is becuase VTERF ( Contract) is of type CHAR and length 20, where as SELW2 is of type CHAR but Length 35. I know the length and type should be the same. But this table DFKKZP strangely has SELW2(Contract) has length 35.
Can someone please suggest me how to handle this inorder for me to get this correct?.
Thanks in adv.
Regards
BNHi,
try this and let me know if it works.
Declare another internal table and work area like it_data1 type it_data as shown below.
Begin of it_data1_wa,
......... type........,
......... type .......,
SELW2 type dfkkzp-SELW2,
end if it_data_wa1.
data: it_data1 like standard table of it_data_wa.
data: it_data_wa type it_data
include all the fields inside the table.
loop at it_data into it_data_wa.
move corresponding lt_data_wa to it_data1_wa.
it_data1_wa-SELW2 = it_data_wa-VTREF.
append it_data1_wa to it_data1.
end loop.
now write the same select statement for all entries in it_data1 instead of it_data.
Regards,
Anusha -
Sql Error in Select statement when doing subquery
Hi,
I am trying to see what the error is in the subquery part of the select statement.
Subquery should be fetching the safety_stock_quantity based on the MAX(effectivity_date).
Any suggestions?
SELECT kbn.last_update_date,itm.segment1,itm.description,kbn.kanban_card_number,kbn.kanban_size,
(SELECT msc.safety_stock_quantity
FROM mtl_safety_stocks msc
WHERE msc.effectivity_date = (select MAX(msc2.effectivity_date)
from mtl_safety_stocks msc2
where msc2.inventory_item_id = itm.inventory_item_id
and msc2.organization_id = itm.organization_id)
AND msc.inventory_item_id = itm.inventory_item_id
AND msc.organization_id = itm.organization_id
FROM mtl_system_items_b itm
,mtl_onhand_quantities_detail moqd
,mtl_safety_stocks msc
,mtl_kanban_card_activity kbn
WHERE itm.inventory_item_id = kbn.inventory_item_id
AND itm.organization_id = kbn.organization_id
AND itm.inventory_item_id = moqd.inventory_item_id
AND itm.organization_id = moqd.organization_id
AND moqd.subinventory_code = kbn.source_subinventory
AND kbn.card_status = 1
AND kbn.supply_status = 5
AND msc.inventory_item_id = itm.inventory_item_id
AND msc.organization_id = itm.organization_id
GROUP BY
kbn.last_update_date,itm.segment1,itm.description,kbn.kanban_card_number,kbn.kanban_size;
Thanks
PravnHi, Pravn,
Remember the ABC's of GROUP BY:
When you use a GROUP BY clause and/or an aggregate fucntion, then every item in the SELECT clause must be:
(A) an <b>A</b>ggregate function,
(B) one of the "group <b>B</b>y" expressions,
(C) a <b>C</b>onstant, or
(D) something that <b>D</b>epends entirely on the above. (For example, if you "GROUP BY TRUNC(dt)", you can "SELECT TO_CHAR (TRUNC(dt), 'Mon-DD')").
There's a GROUP BY clause in your main query, so every item in the main SELECT clause must be one of the above. The last item, the unnamed scalar sub-query, is none of the above.
How can you fix this problem? That depends on your data, the results you want, and perhaps on your Oracle version. If you'd like help, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved. Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Always say which version of Oracle you're using.
You may have noticed that this site normally doesn't display multiple spaces in a row.
Whenever you post formatted text (including, but limited to, actual code) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing. -
Sequence error in select statement
Does anyone know why I get the following error when I run the code below. If so, how can it be fixed.
Thanks in advance,
John C
ORA-02287 sequence number not allowed here
INSERT INTO PROMO_STAGE.NAC_OFFER (CMPGN_KEY, OFFER_KEY, CREATIVE)
SELECT DISTINCT A.CREATIVE,
B.CMPGN_KEY,
PROMO_STAGE.SEQ_NAC_OFFER_KEY.NEXTVAL@DSTAGE
FROM PROMO_STAGE.CAMPAIGN@DSTAGE B,
ROCEONOF.NACQ0211_2_FINAL@OGD A
WHERE B.CMPGN_ID = 'NAC_'|| to_char(add_months(SYSDATE,-1),'YYYYMM');John
It is the DISTINCT which is causing the trouble. How about:
INSERT INTO PROMO_STAGE.NAC_OFFER (CMPGN_KEY, OFFER_KEY, CREATIVE)
SELECT COL1, COL2, PROMO_STAGE.SEQ_NAC_OFFER_KEY.NEXTVAL@DSTAGE
FROM
(SELECT DISTINCT A.CREATIVE COL1, B.CMPGN_KEY COL2
FROM PROMO_STAGE.CAMPAIGN@DSTAGE B,
ROCEONOF.NACQ0211_2_FINAL@OGD A
WHERE B.CMPGN_ID = 'NAC_'|| to_char(add_months(SYSDATE,-1),'YYYYMM'));
Incidentally, judging by the column names, it appears that the columns in your insert statement are not listed in the same order as in the select statement, which of course they should be. -
Performance Tuning 'Runtime Error' on Select statement
Hi Experts,
Good Day!
I would like to ask some help regarding a custom program that will encounter 'Runtime Error' on the below codes on how to perform performance tunning especially number 1.
1.
SELECT A~VBELN A~ERDAT A~AUART A~VKORG A~VTWEG A~SPART A~VDATU
A~KUNNR B~POSNR B~MATNR B~ARKTX B~ABGRU B~KWMENG B~VRKME
B~WERKS B~VSTEL B~ROUTE
FROM VBAK AS A INNER JOIN VBAP AS B ON A~VBELN EQ B~VBELN
INNER JOIN VBEP AS C ON A~VBELN EQ C~VBELN
AND B~POSNR EQ C~POSNR
INTO CORRESPONDING FIELDS OF TABLE I_DATA_TAB
WHERE A~VBELN IN S_VBELN
AND A~VKORG IN S_VKORG
AND A~AUART IN S_AUART
AND A~VTWEG IN S_VTWEG
AND A~SPART IN S_SPART
AND A~VDATU IN S_VDATU
AND A~KUNNR IN S_KUNNRD
AND B~MATNR IN S_MATNR
AND B~KWMENG IN S_KWMENG
AND B~VRKME IN S_VRKME
AND B~WERKS IN S_WERKS
AND C~EDATU IN S_VDATU.
2.
SELECT VBELN FROM LIKP INTO LIKP-VBELN
WHERE LFDAT IN S_VDATU
AND VKORG IN S_VKORG
AND LFART EQ 'YSTD'
AND KUNNR IN S_KUNNRP
AND KUNAG IN S_KUNNRD
SELECT VBELN POSNR LFIMG MATNR WERKS
FROM LIPS INTO (LIPS-VBELN, LIPS-POSNR, DISPLAY_TAB-DEL_QTY,
LIPS-MATNR, LIPS-WERKS)
WHERE VBELN EQ LIKP-VBELN
AND MATNR IN S_MATNR
AND VTWEG IN S_VTWEG
AND SPART IN S_SPART
AND WERKS IN S_WERKS.
ENDSELECT.
ENDSELECT.
4.
SELECT DELIVERY POSNR MATNR PODLFIMG FROM T9YPODI INTO
(T9YPODI-DELIVERY, T9YPODI-POSNR, T9YPODI-MATNR, T9YPODI-PODLFIMG)
WHERE MATNR IN S_MATNR
AND PODDATE IN S_VDATU.
Answer's will be a great help.
~Thank You,
Lourd
Edited by: Lourd06 on Oct 23, 2009 10:32 AM
Moderator message - Welcome to SCN.
Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting. You're in the driver's seat here. It's up to you to do some analysis before expecting that people can halp you. - post locked
And please use code tags.
Edited by: Rob Burbank on Oct 23, 2009 9:13 AMHi All,
We've checked the transaction ST22 it is TIME OUT. I really need your help on this the program will dump in number 1 Select statement. Can you help me perform a performance tunning.
In transaction ST22
Runtime Errors TIME_OUT
Date and Time 21.10.2009 08:51:33
Short text
Time limit exceeded.
What happened?
The program "ZV0PSR10" has exceeded the maximum permitted runtime without
interruption and has therefore been terminated.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
After a specific time, the program is terminated to make the work area
available to other users who may be waiting.
This is to prevent a work area being blocked unnecessarily long by, for
example:
- Endless loops (DO, WHILE, ...),
- Database accesses with a large result set
- Database accesses without a suitable index (full table scan)
The maximum runtime of a program is limited by the system profile
parameter "rdisp/max_wprun_time". The current setting is 1200 seconds. If this
time limit is
exceeded, the system attempts to cancel any running SQL statement or
signals the ABAP processor to stop the running program. Then the system
waits another 60 seconds maximum. If the program is then still active,
the work process is restarted.
~Thank you
Lourd
Edited by: Lourd06 on Oct 23, 2009 11:22 AM
Edited by: Lourd06 on Oct 23, 2009 11:33 AM -
Runtime error for SELECT statement
Hi All,
I have written a SELECT statement as follows in my code.
select budat pernr aufnr vornr from AFRU
into corresponding fields of table it_vornr
for all entries in it_cats_tmp
where budat = it_cats_tmp-workdate
and pernr = it_cats_tmp-pernr
and aufnr = it_cats_tmp-rnplnr.
The table IT-CATS_TMP is having around 3000+ lines.
When control moves to this statement, the system is throwing Runtime error or its taking around 30 minutes time to execute.
If i query the same table (AFRU) in SE11 for the same set of conditions, the table displays relevent data immediately.
What might be the reason for this delay/Runtime Error?
Shall i need to change the syntax for better performance?
Your guidelines are highly appreciated......
Regards
PavanHi
1. Try to put WHERE conditions for KEY FIELDS.
Solution: Create a RANGE for the key fields & put that in SELECT Query.
DATA: gr_rueck TYPE RANGES OF afru-rueck.
SELECT .. WHERE rueck IN gr_rueck.
2. Avoid using CORRESPONDING FIELDS OF TABLE in SELECT.
Solution: Change internal table fields ORDER.
TYPES:
BEGIN OF TY_VORNR,
budat TYPE ..
pernr TYPE ..
aufnr TYPE ..
vornr TYPE ..
... " Other fields
END OF TY_VORNR.
SELECT .. INTO TABLE IT_VORNR ... -
Hi All,
I am getting the error 'Comma without preceding colon (after SELECT ?).' with the following select statement. Can someone help me with the error.
select single actdate_from actdate_to
into ( lv_actdate_from, lv_actdate_to )
from zsdcoop
where kunnr = wa-kunnr and pfnum = wa-pfnum.
if ( lv_actdate_from NE wa-actdate_from ) or ( lv_actdate_to NE wa-actdate_to ).
wa-block = 'X'.
Endif.
Thanks,
Veni.Typically, on statements like this, you want to use AND instead of OR. Google "truth tables" for a detailed explanation of why.
if ( lv_actdate_from NE wa-actdate_from ) or ( lv_actdate_to NE wa-actdate_to ).
wa-block = 'X'.
Should probably be:
if ( lv_actdate_from NE wa-actdate_from ) AND ( lv_actdate_to NE wa-actdate_to ).
wa-block = 'X'. -
Error in Select statement from DBLINK
Hi,
I have created a DBLink DBLNK206 as below:
CREATE PUBLIC DATABASE LINK DBLNK206
CONNECT TO BIO
IDENTIFIED BY BIO
USING '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.60.201)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))';
But when from the local schema I execute the select statement
select * from BNK_FRHNBK@DBLNK206;
ORA-12170 - TNS:Connect timeout occurred
But when directly connecting the same schema through sqldeveloper or toad
and executing the
select * from BNK_FRHNBK ;
I am getting the desired output.
Any help regarding this will be greatly appreciated.
Thanks In Advance
AshwiniMake sure tnsping to ORCL database is working fine and use tns alias name like using 'orcl.world'; insted of full description.
>
USING '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.60.201)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))';
>
http://www.dba-oracle.com/t_how_create_database_link.htm
Edited by: %bala% on May 2, 2013 1:12 PM -
Regarding error in select statement
Hello CRM Gurus,
i have 2 questions to ask from you all:-
1. i am getting a problem of overlapping of values fetched by select statement.. so any idea what shall i do?
2. practically when we use for all entries in select statement if possible explain through a buisness scenario?
anhiyta ..HI Anhitya,
1. for select statement are you using both the select statement in 1 loop or in 1 condition?
2. we use for all entries when we require to compare on basis of all the entries present in a table
for example if u have to fetch address of a bp partner then u wiill select bp from but000 into itab
and den u will write select addr from butadr for all entries in itab.
i hope this may help
saloni -
Hello experts,
i am quite new to forms and i am trying to do a select based on a condition. but its giving me and error
post_query
begin
if :EFT_EXCLUSION.retailer_num <> null and :EFT_EXCLUSION.bank_acct = null
select retailer_name
into :EFT_EXCLUSION.retailer_name
from retailers
where retailer_num = :EFT_EXCLUSION.retailer_num;
else if :EFT_EXCLUSION.bank_acct <> null
select retailer_name
into :EFT_EXCLUSION.retailer_name
from retailers
where bank_account_id = :EFT_EXCLUSION.bank_acct;
end if
end;error
encountering the symbol SELECT when expecting one of the following
i'm not too sure if my code is okif :EFT_EXCLUSION.retailer_num is NULL and :EFT_EXCLUSION.period_id is NULL thenTry to check you this statement i mean THAT :EFT_EXCLUSION.retailer_num and :EFT_EXCLUSION.period_id are NULL or not to make sure create one message before calling this procedure to check the values of these fields.
EFT_EXCLUSION.SAVEAlso confirm the name of this button i mean block and button name are same as you defined.
For the debug create message before calling this procedure like
MESSAGE(':EFT_EXCLUSION.retailer_num='||:EFT_EXCLUSION.retailer_num||' :EFT_EXCLUSION.period_id='|| :EFT_EXCLUSION.period_id);
MESSAGE(':EFT_EXCLUSION.retailer_num='||:EFT_EXCLUSION.retailer_num||' :EFT_EXCLUSION.period_id='|| :EFT_EXCLUSION.period_id); place these lines before calling the procedure you created so it will be sure that both the fields are NULL and for the items ENABLE/DISABLE we use the same code which i gave you before. Problem is in you IF condition.
-Ammad -
i am getting the following error after executing the below mentioned statements
ORA-00904: "BR"."MPR_ID": invalid identifier
00904. 00000 - "%s: invalid identifier"
select 'insert into FRP_MD_VALUES(FRPDES_ID,MPR_ID,VALUE) values (1,' || BR.mpr_id ||',' || BD.wert_num ||');'
from BERICHTSDATEN BD, BERICHTE BR
where
BD.STAND_DAT = TO_DATE('072010','MMYYYY') and
BD.brg_id = 4146
AND BD.BRT_ID=BR.BRT_ID
AND BR.MPR_ID Is not null
union all
select 'insert into FRP_MD_VALUES(FRPDES_ID,MPR_ID,VALUE) values (3,' || BR.mpr_id ||',' || -BD.wert_num ||');'
from BERICHTSDATEN BD, BERICHTE BR
where
BD.STAND_DAT = TO_DATE('072010','MMYYYY') and
BD.brg_id = 4166
AND BD.BRT_ID=BR.BRT_ID
AND BR.MPR_ID Is not null
ORDER BY BD.FRDES_ID;
but if i am excluding the order by br.mpr_id statement i am not getting any error ,
could u please help is there any prob with the syntaxHi,
Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements) so people can re-create the problem and test their solutions.
user13375778 wrote:
i am getting the following error after executing the below mentioned statements
ORA-00904: "BR"."MPR_ID": invalid identifier
00904. 00000 - "%s: invalid identifier"Are you sure thie error message above is being caused by the query below?
If you would post some sample data, we wouldn't have to guess, and you'd get a good answer sooner.
>
>
select 'insert into FRP_MD_VALUES(FRPDES_ID,MPR_ID,VALUE) values (1,' || BR.mpr_id ||',' || BD.wert_num ||');'
from BERICHTSDATEN BD, BERICHTE BR
where
BD.STAND_DAT = TO_DATE('072010','MMYYYY') and
BD.brg_id = 4146
AND BD.BRT_ID=BR.BRT_ID
AND BR.MPR_ID Is not null
union all
select 'insert into FRP_MD_VALUES(FRPDES_ID,MPR_ID,VALUE) values (3,' || BR.mpr_id ||',' || -BD.wert_num ||');'
from BERICHTSDATEN BD, BERICHTE BR
where
BD.STAND_DAT = TO_DATE('072010','MMYYYY') and
BD.brg_id = 4166
AND BD.BRT_ID=BR.BRT_ID
AND BR.MPR_ID Is not null
ORDER BY BD.FRDES_ID;
but if i am excluding the order by br.mpr_id statement i am not getting any error ,
could u please help is there any prob with the syntaxDon't use table names or aliases (like BD or BR) in the ORDER BY clause of a UNION.
In a UNION, unlike most other queires, you can only ORDER BY columns in the output.
That means you can't say "ORDER BY <b>BD.</b>FRDES_ID", because the output column is called FRDES_ID.
That would explain why you would get an error
ORA-00904: <b>"BD"."FRDES_ID"</b>: invalid identifier. If you're getting the error
ORA-00904: <b>"BR"."MPR_ID"</b>: invalid identifier, then either you don't have a column by that name in that table, or you're running a query other than the one you posted, perhaps one that has "<b>BR.</b>MPR_ID" in the ORDER BY clause. -
Syntax Error in SELECT statement
Hi,
My ABAP statement is:
select b1~fa a1~fb
INTO CORRESPONDING FIELDS OF TABLE it_1
from (table_nm) as a1 inner join db_tab2 as b1
on a1~fb = b1~fb.
For this statement it gives me following error in syntax check:
*Wrong expression "INNER" in FROM clause. WHERE condition. *
Thanks,
CDHi
Try something like this:
DATA: BEGIN OF ITAB OCCURS 0,
A,
B,
END OF ITAB.
DATA: TABLENAME(30).
DATA: WA_FTAB(72) TYPE C,
FTAB LIKE TABLE OF WA_FTAB.
WA_FTAB = 'A'. APPEND WA_FTAB TO FTAB.
SELECT (FTAB) FROM (TABLENAME) INTO TABLE ITAB.
LOOP AT ITAB.
SELECT SINGLE A FRO <TABLE 2>
INTO ITAB-B
WHERE A = ITAB-A.
MODIFY ITAB.
ENDLOOP.
See this sample:
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
VKORG LIKE VBAK-VKORG,
END OF ITAB.
DATA: TABLENAME(30) VALUE 'VBAP'.
DATA: WA_FTAB(72) TYPE C,
FTAB LIKE TABLE OF WA_FTAB.
WA_FTAB = 'VBELN'. APPEND WA_FTAB TO FTAB.
WA_FTAB = 'POSNR'. APPEND WA_FTAB TO FTAB.
SELECT (FTAB) UP TO 10 ROWS FROM (TABLENAME) INTO TABLE ITAB.
LOOP AT ITAB.
SELECT SINGLE VKORG FROM VBAK INTO ITAB-VKORG
WHERE VBELN = ITAB-VBELN.
MODIFY ITAB.
ENDLOOP. -
Error when select statement was gien
i gave select count(*) from <tablename> on a table.i gort error ora -01578: ORACLE data block corrupted (file # 12, block # 15712).i gave statement
alter session set events '10231 trace name context forever,level 10' created the table again from problematic table.i am getting the problem overcome and after connecting for the second time to that user i am getting the same error .
can any one suggest me.Duplicate thread:
block corruption -
Why does plsql give compilation error for select statement?
When I run following plsql program, it gives compilation error. Could somebody please point me out what could be wrong here? I am running it from system user.
create or replace procedure drop_user_proc (iname in varchar2) is
uname varchar2(100);
begin
select username into uname from dba_users where username = upper(iname);
end drop_user_proc;
select username from dba_users where username = upper('newuser');
When I run it, I get following error. dba_users is there that is the reason it works outside plsql block, but it doesn't from inside block.
SQL> @t4
Warning: Procedure created with compilation errors.
USERNAME
NEWUSER
SQL> show err
Errors for PROCEDURE DROP_USER_PROC:
LINE/COL ERROR
4/3 PL/SQL: SQL Statement ignored
4/35 PL/SQL: ORA-00942: table or view does not existRole based grants are not available within the stored procedures.
Only explicit grants are recognized when compiling stored code.
You need to grant select on that table to the user where you are creating this procedure.
Maybe you are looking for
-
I know what a domain name is for the external web, but what forms of words are acceptable to OS X Server for an intranet? I don't want to have to pay to register a domain name acceptable to the rest of the web, I just want something meaningful for my
-
Hiding methods and attributes while inheriting
Hello All, This is kinda urgent. While making a subclass I want to block access to methods and attributes of super class when anone creates an object of sub-class. In my particular situation I cannot override the methods. Let me explain it with an ex
-
Can we call custom functions in view objects?
Can we call custom functions in view objects?these custom functions are from my backing bean... Please help.....
-
Export Bitmap images to local server
Hi, I have a requirement to export bitmap image from se78 to local server. Please suggest me is there any tcode or standard program to do this. Thanks. Tony
-
RE: (forte-users) Formatting a number
Thank you. That worked out great. ka -----Original Message----- From: Thompson Ian [mailto:Ian.Thompsonicl.com] Sent: Friday, February 18, 2000 9:35 AM To: 'Amin, Kamran'; 'Forte User' Subject: RE: (forte-users) Formatting a number Ka, Try using Text