Java-SQL Query, Its Urgent.....................
hi,
my problem is that i want to get data from the oracle database(SQL) and then put it into a JTABLE.
The data seems to come correctly into the ResultSet rs Object, but i dont know how to put the data from the rs Object into the JTable.
Please reply,
Hi,
If this is really important, I suggest that you post your question in the Swing Forums. As it is more appropriate for that forum, and you will get a quicker response.
Damian Sutton.
Similar Messages
-
SQL Query Parser(urgent)
Hi
every body i have a requirement of SQL Query parser,
This SQL Query parser should give me a column names and tables name in the query ,parsing the query , the query may be any complex query it might like
SELECT CONVERT(bigint, EMD_DATE_TIME) AS CURRENTTIME FROM EVENT_METER_DAY.
If i pass this query i should get, appropriate columname and table name which is being queried
DO anybody knows any avaialble SQL parsers , and do to achieve this
thanks and regards
anilWhy don't you use ResultSetMetaData instead? If you need to parse the query string before executing it, probably you have to write your own parser.
-
Bat files from java application..its urgent pls help me
hi
My java application tries to execute the bat file, the code followes
Runtime runs = Runtime.getRuntime();
runs.exec("e:/customisation/test.bat");
The bat file contains commands to copy files from one folder to another
and some dos commands, but the commands are not executing. If i tried the bat file with some exe's like notepad its working well, but not working with dos commands.
thanks in advance
nisamHi
Your batch file will be working actually. But no output will be seen in the console window.
For example I had created a batch file with the folowing code
echo This is test
copy test.bat test1.bat
pause
Even though I can't see the messages in the console, it executed when called using
Runtime runs = Runtime.getRuntime();
runs.exec("hi.bat");
where hi.bat contains the above code.
If you want to see the output messages also in the console, you have to redirect the outputstream to the current console. One such class this does is available somewhere in Java(I don't exactly remember :-( ). I think it is StreamPluginThread.java
Regards -
Error when executing query its urgent
hi,
when iam executing my query in query designer through web morning i got the result in web.
but when iam executing the same query in wad it is throughing an error like (System error in program SAPLRRK0 and form GET_FIELD_POSITION-01-))
now again i check that one in querydesigner again it is showing the same error in querydesigner also
vijayHi,
Refer Note 931975 - Problems when you execute a query
Symptom
At runtime, a query contains a generated ABAP program and a data structure, which is stored in the shared buffer. Due to the gap described here, the version of the ABAP program may not correspond to the version of the data structure.
This causes several terminations when you execute this query:
X299 Brain SAPLRRK0; Form GET_FIELD_POSITION-01-,
X299 Brain SAPLRRK0; Form APPEND_KHANDLE_1-02-,
ASSIGN COMPONENT L_FIELDNAME OF STRUCTURE C_SX_GVAR, and others.
Other terms
RSIX, SX_REPORT,
Reason and Prerequisites
The error can occur if one person changes a query and another person simultaneously executes the query. A query may also be changed implicitly if one of the objects used in the query is changed in another query.
Solution
The attached corrections apply only to Releases 3.X. An advance correction cannot be provided for NetWeaver 2004s.
Before you implement the attached correction (in 3.X), you must change the two following method interfaces. Otherwise syntax errors occur in the CL_RSR_REPORT_RSIX class and the RRI0 function group when you implement the corrections.
1. In Transaction SE24: Change the MODIFY method of the CL_RSR_REPORT_RSIX class as follows:
Insert the I_S_RKB1D import parameter with the type RSR_S_RKB1D.
2. In Transaction SE24: Change the READ_SX_REPORT method of the CL_RSR_REPORT_RSIX class.
Delete all existing import parameters (that is, I_GENUNIID, I_DVERS, I_IDVERS and I_GENTIME) and insert the I_S_RKB1D import parameter with the type RSR_S_RKB1D.
After you implement the corrections, you must delete the incorrect information in the shared buffer. To do this, enter '/$SYNC' in the command field in every application server. Alternatively, you can also call RSRT -> Environment -> Generate Queries. As a result, all queries are regenerated but all OLAP caches are rejected.
BW 3.0B
Import Support Package 31 for 3.0B (BW 3. 0B Patch 31 or SAPKW30B31) into your BW system. The Support Package is available when Note 0872272 "SAPBWNews BW 3.0B Support Package 31", which describes this Support Package in more detail, is released for customers.
BW 3.10 Content
Import Support Package 25 for 3.10 (BW 3. 10 Patch 25 or SAPKW31025) into your BW system. The Support Package is available when Note 0872274 "SAPBWNews BW 3.1 Content Support Package 25", which describes this Support Package in more detail, is released for customers.
BW 3.50
Import Support Package 17 for 3.5 (BW 3. 50 Patch 17 or SAPKW35017) into your BW system. The Support Package is available when Note 0872277 "SAPBWNews BW Support Package 17 NetWeaver'04 Stack 17", which describes this Support Package in more detail, is released for customers.
SAP NetWeaver 2004s BI
Import Support Package 08 for SAP NetWeaver 2004s BI (BI Patch 08 or SAPKW70008) into your BI system. The Support Package is available when Note 0872280 "SAPBINews BI 7.0 Support Package 08", which describes this Support Package in more detail, has been released for customers.
In urgent cases, you can use the correction instructions.
To provide information in advance, the notes mentioned above may be released before the Support Package is available. In this case, however, the short text of the notes still contains the words "preliminary version".
Thanks -
Hi Experts,
In this scenario we have one Material Mat1 and 2 plants namely, P1 and P2. At time of execution, in the selection screen, if we give for example: Mat1 and P1, data is displayed for that particular material and plant. Where as if we give MAT1 for P1 and P2 , the material again displayed for P1 which is in first row and it is not displaying the material for P2 which is in 2nd row.
If we interchange P2 is in first row, the material is displayed and it is not displaying for P1 which is in 2nd row.
In general Any material for any plant which is in 2nd row is not displayed only zeros are visible.
Kindly locate the solution for the above query in the below program.
Specification Name : Production Tracker
REPORT zpp_ptk .
TYPE-POOLS : slis.
TABLES : pbed,
mara,
mast,
marc,
makt,
pbid,
pbim,
stpo,
t001w,
scal,
kna1,
knmt,
equi,
a304,
konp,
zcalendar,
am60x.
DATA : gt_sort TYPE slis_t_sortinfo_alv,
gt_fieldcat TYPE slis_t_fieldcat_alv,
gt_fieldcat1 TYPE slis_fieldcat_alv,
gt_events TYPE slis_t_event ,
gv_pc_start(2) TYPE n,
gv_pcno(6),
BEGIN OF gt_pbed OCCURS 0,
matnr TYPE matnr,
p_matnr TYPE matnr,
plnmg TYPE plnmg,
entmg TYPE entmg,
perxx TYPE perxx,
ojtxb TYPE ojtxb,
ojtxp TYPE ojtxp,
backlog TYPE plnmg,
future TYPE plnmg,
END OF gt_pbed,
l_knumh LIKE a304-knumh, " added by ****** 08.06.2005
l_datab LIKE a304-datab, " added by ****** 08.06.2005
BEGIN OF it_date1 OCCURS 0,
it_date1 TYPE zstartdt,
enddt TYPE zenddt,
sapweekno TYPE zsapweekno,
END OF it_date1,
BEGIN OF gt_matnr OCCURS 0,
matnr TYPE matnr,
plnmg TYPE plnmg,
entmg TYPE entmg,
END OF gt_matnr,
BEGIN OF gt_stock OCCURS 0,
matnr TYPE matnr,
stock TYPE entmg,
END OF gt_stock,
gt_fpbed LIKE gt_pbed OCCURS 0 WITH HEADER LINE,
it_zcalendar LIKE zcalendar OCCURS 0 WITH HEADER LINE,
l_counter TYPE i,
l_plus15 LIKE scal-week,
l_wfpweekno LIKE scal-week,
l_selectedweekno LIKE scal-week,
BEGIN OF gt_backlog OCCURS 0,
matnr TYPE matnr,
backlog TYPE entmg,
END OF gt_backlog,
gt_future LIKE gt_backlog OCCURS 0 WITH HEADER LINE,
gt_output TYPE zpp_rollplan OCCURS 0 WITH HEADER LINE,
BEGIN OF gt_out OCCURS 0,
head(15) TYPE c,
matnr TYPE matnr,
stock TYPE labst,
backlog TYPE plnmg,
week1 TYPE wmeng,
week2 TYPE wmeng,
week3 TYPE wmeng,
week4 TYPE wmeng,
week5 TYPE wmeng,
week6 TYPE wmeng,
week7 TYPE wmeng,
week8 TYPE wmeng,
week9 TYPE wmeng,
week10 TYPE wmeng,
week11 TYPE wmeng,
week12 TYPE wmeng,
week13 TYPE wmeng,
END OF gt_out,
BEGIN OF gt_out26 OCCURS 0,
head(15) TYPE c,
matnr TYPE matnr,
stock TYPE labst,
backlog TYPE plnmg,
week1 TYPE wmeng,
week2 TYPE wmeng,
week3 TYPE wmeng,
week4 TYPE wmeng,
week5 TYPE wmeng,
week6 TYPE wmeng,
week7 TYPE wmeng,
week8 TYPE wmeng,
week9 TYPE wmeng,
week10 TYPE wmeng,
week11 TYPE wmeng,
week12 TYPE wmeng,
week13 TYPE wmeng,
week14 TYPE wmeng,
week15 TYPE wmeng,
week16 TYPE wmeng,
week17 TYPE wmeng,
week18 TYPE wmeng,
week19 TYPE wmeng,
week20 TYPE wmeng,
week21 TYPE wmeng,
week22 TYPE wmeng,
week23 TYPE wmeng,
week24 TYPE wmeng,
week25 TYPE wmeng,
week26 TYPE wmeng,
END OF gt_out26,
BEGIN OF it_week OCCURS 0,
it_week TYPE zsapweekno,
END OF it_week,
dd(4) TYPE c,
cc(2) TYPE c,
dd1(6) TYPE c,
l_val1(7) TYPE c,
l_val2(7) TYPE c,
l_val3(7) TYPE c,
l_val4(7) TYPE c,
l_val5(7) TYPE c,
l_val6(7) TYPE c,
l_val7(7) TYPE c,
l_val8(7) TYPE c,
l_val9(7) TYPE c,
l_val10(7) TYPE c,
l_val11(7) TYPE c,
l_val12(7) TYPE c,
l_val13(7) TYPE c,
l_val14(7) TYPE c,
l_val15(7) TYPE c,
l_val16(7) TYPE c,
l_val17(7) TYPE c,
l_val18(7) TYPE c,
l_val19(7) TYPE c,
l_val20(7) TYPE c,
l_val21(7) TYPE c,
l_val22(7) TYPE c,
l_val23(7) TYPE c,
l_val24(7) TYPE c,
l_val25(7) TYPE c,
l_val26(7) TYPE c,
it_ph TYPE plnmg,
it_dm TYPE dbmng,
it_mard LIKE mard OCCURS 0 WITH HEADER LINE,
it_tot1 TYPE p DECIMALS 3,
it_tot1_2 TYPE p DECIMALS 3,
it_tot2 TYPE p DECIMALS 3,
it_tot2_2 TYPE p DECIMALS 3,
it_tot3 TYPE p DECIMALS 3,
it_tot3_2 TYPE p DECIMALS 3,
it_tot4 TYPE p DECIMALS 3,
it_tot4_2 TYPE p DECIMALS 3,
it_tot5 TYPE p DECIMALS 3,
it_tot5_2 TYPE p DECIMALS 3,
it_tot6 TYPE p DECIMALS 3,
it_tot6_2 TYPE p DECIMALS 3,
it_tot7 TYPE p DECIMALS 3,
it_tot7_2 TYPE p DECIMALS 3,
it_tot8 TYPE p DECIMALS 3,
it_tot8_2 TYPE p DECIMALS 3,
it_tot9 TYPE p DECIMALS 3,
it_tot9_2 TYPE p DECIMALS 3,
it_tot10 TYPE p DECIMALS 3,
it_tot10_2 TYPE p DECIMALS 3,
it_tot11 TYPE p DECIMALS 3,
it_tot11_2 TYPE p DECIMALS 3,
it_tot12 TYPE p DECIMALS 3,
it_tot12_2 TYPE p DECIMALS 3,
it_tot13 TYPE p DECIMALS 3,
it_tot13_2 TYPE p DECIMALS 3,
it_tot14 TYPE p DECIMALS 3,
it_tot14_2 TYPE p DECIMALS 3,
it_tot15 TYPE p DECIMALS 3,
it_tot15_2 TYPE p DECIMALS 3,
it_tot16 TYPE p DECIMALS 3,
it_tot16_2 TYPE p DECIMALS 3,
it_tot17 TYPE p DECIMALS 3,
it_tot17_2 TYPE p DECIMALS 3,
it_tot18 TYPE p DECIMALS 3,
it_tot18_2 TYPE p DECIMALS 3,
it_tot19 TYPE p DECIMALS 3,
it_tot19_2 TYPE p DECIMALS 3,
it_tot20 TYPE p DECIMALS 3,
it_tot20_2 TYPE p DECIMALS 3,
it_tot21 TYPE p DECIMALS 3,
it_tot21_2 TYPE p DECIMALS 3,
it_tot22 TYPE p DECIMALS 3,
it_tot22_2 TYPE p DECIMALS 3,
it_tot23 TYPE p DECIMALS 3,
it_tot23_2 TYPE p DECIMALS 3,
it_tot24 TYPE p DECIMALS 3,
it_tot24_2 TYPE p DECIMALS 3,
it_tot25 TYPE p DECIMALS 3,
it_tot25_2 TYPE p DECIMALS 3,
it_tot26 TYPE p DECIMALS 3,
it_tot26_2 TYPE p DECIMALS 3,
it_back1 TYPE p DECIMALS 3,
it_back2 TYPE p DECIMALS 3,
it_back3 TYPE p DECIMALS 3,
it_back4 TYPE p DECIMALS 3,
it_back5 TYPE p DECIMALS 3,
it_back6 TYPE p DECIMALS 3,
it_back7 TYPE p DECIMALS 3,
it_back8 TYPE p DECIMALS 3,
it_back9 TYPE p DECIMALS 3,
it_back10 TYPE p DECIMALS 3,
it_back11 TYPE p DECIMALS 3,
it_back12 TYPE p DECIMALS 3,
it_back13 TYPE p DECIMALS 3,
it_back14 TYPE p DECIMALS 3,
it_back15 TYPE p DECIMALS 3,
it_back16 TYPE p DECIMALS 3,
it_back17 TYPE p DECIMALS 3,
it_back18 TYPE p DECIMALS 3,
it_back19 TYPE p DECIMALS 3,
it_back20 TYPE p DECIMALS 3,
it_back21 TYPE p DECIMALS 3,
it_back22 TYPE p DECIMALS 3,
it_back23 TYPE p DECIMALS 3,
it_back24 TYPE p DECIMALS 3,
it_back25 TYPE p DECIMALS 3,
it_back26 TYPE p DECIMALS 3,
it_pbhi LIKE pbhi OCCURS 0 WITH HEADER LINE,
int1 TYPE i,
int2 TYPE i,
int3 TYPE i,
int4 TYPE i,
int5 TYPE i,
int6 TYPE i,
int7 TYPE i,
int8 TYPE i,
int9 TYPE i,
int10 TYPE i,
int11 TYPE i,
int12 TYPE i,
int13 TYPE i,
int14 TYPE i,
int15 TYPE i,
int16 TYPE i,
int17 TYPE i,
int18 TYPE i,
int19 TYPE i,
int20 TYPE i,
int21 TYPE i,
int22 TYPE i,
int23 TYPE i,
int24 TYPE i,
int25 TYPE i,
int26 TYPE i,
*forecast purpose
p_fnavl TYPE c VALUE 'X',
it_zcal LIKE zcalendar OCCURS 0 WITH HEADER LINE,
BEGIN OF it_mkpf OCCURS 0,
mblnr TYPE mblnr,
budat TYPE budat,
END OF it_mkpf,
it_mseg LIKE mseg OCCURS 0 WITH HEADER LINE,
st_date TYPE zstartdt,
en_date TYPE zenddt.
*BUDAT
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001..
SELECT-OPTIONS : s_matnr FOR pbim-matnr OBLIGATORY.
PARAMETERS : p_werks TYPE werks_d OBLIGATORY,
p_dispo TYPE dispo,
p_mov TYPE bwart OBLIGATORY DEFAULT '321',
p_date1 TYPE pbed-wdatu DEFAULT '20070401'. " MODIF ID ABC..
*SELECT-OPTIONS : p_date2 FOR pbed-wdatu.
PARAMETERS : p_date2 TYPE wdatu.
SELECTION-SCREEN : END OF BLOCK blk1.
SELECTION-SCREEN : BEGIN OF BLOCK bb1 WITH FRAME TITLE text-002 .
PARAMETERS : p_13week RADIOBUTTON GROUP grp1,
p_26week RADIOBUTTON GROUP grp1.
SELECTION-SCREEN : END OF BLOCK bb1.
SELECT-OPTIONS : s_week FOR zcalendar-sapweekno NO-DISPLAY.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_DATE1'.
screen-input = '0'.
screen-active = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
INITIALIZATION.
START-OF-SELECTION.
IF '20070401' > p_date2.
MESSAGE 'Please Give Greater that 01.04.2007 ' TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
SELECT SINGLE sapweekno INTO s_week-low
FROM zcalendar
WHERE startdt >= p_date2. "-high AND enddt >= p_date2-low.
s_week-option = 'EQ'.
s_week-sign = 'I'.
APPEND s_week.
SELECT * FROM zcalendar INTO TABLE it_zcalendar.
SELECT * FROM mard INTO TABLE it_mard WHERE matnr IN s_matnr.
*********************FOR 13 WEEK*********************************************************************
IF p_13week EQ 'X'.
LOOP AT s_week.
s_week-high = s_week-low + 12.
MODIFY s_week TRANSPORTING high.
SELECT SINGLE startdt FROM zcalendar INTO st_date WHERE sapweekno = s_week-low.
SELECT SINGLE enddt FROM zcalendar INTO en_date WHERE sapweekno = s_week-high.
SELECT mblnr budat FROM mkpf INTO TABLE it_mkpf WHERE budat GE st_date AND budat LE en_date.
SELECT * FROM mseg INTO TABLE it_mseg FOR ALL ENTRIES IN it_mkpf WHERE mblnr = it_mkpf-mblnr
AND matnr IN s_matnr
AND werks = p_werks
and shkzg = 'S'
AND bwart IN ('321','322','101','102','131','132') .
LOOP AT it_mkpf.
SELECT * FROM mseg INTO it_mseg WHERE mblnr = it_mkpf-mblnr
AND matnr IN s_matnr
AND werks = p_werks
AND shkzg = 'S'
AND bwart IN ('321','322','101','102','131','132') .
APPEND it_mseg.
CLEAR it_mseg.
ENDSELECT.
ENDLOOP.
ENDLOOP.
PERFORM get_pbid.
BREAK-POINT.
PERFORM s_week_days.
PERFORM get_backlog.
PERFORM gt_out.
PERFORM build_fieldccatlog1.
PERFORM 13alv.
ENDIF.
******************END OF 13 WEEK*************************************************************************
*****************For 26 th Week*************************************************************************
IF p_26week EQ 'X'.
LOOP AT s_week.
s_week-high = s_week-low + 25.
MODIFY s_week TRANSPORTING high.
SELECT SINGLE startdt FROM zcalendar INTO st_date WHERE sapweekno = s_week-low.
SELECT SINGLE enddt FROM zcalendar INTO en_date WHERE sapweekno = s_week-high.
SELECT mblnr budat FROM mkpf INTO TABLE it_mkpf WHERE budat GE st_date AND budat LE en_date.
SELECT * FROM mseg INTO TABLE it_mseg FOR ALL ENTRIES IN it_mkpf WHERE mblnr = it_mkpf-mblnr
AND matnr IN s_matnr
AND werks = p_werks
AND shkzg = 'S'
AND bwart IN ('321','322','101','102') .
ENDLOOP.
PERFORM get_pbid.
PERFORM s_26week_days.
PERFORM gt_out26.
PERFORM build_fieldccatlog1.
PERFORM 26alv.
ENDIF.
**************END OF 26 TH WEEK **********************************************************************
*& Form get_pbid
text
FORM get_pbid .
DATA : lv_line TYPE i,
lv_perxx LIKE scal-week.
DATA it_dispo(1) TYPE c. " ashish
LOOP AT s_matnr. " TODAY
BREAK-POINT.
SELECT SINGLE diber INTO it_dispo FROM marc WHERE matnr = s_matnr-low
AND werks = p_werks.
IF it_dispo NE 'X'.
SELECT * FROM pbim WHERE matnr = s_matnr-low
AND werks EQ p_werks
AND loevr = space.
SELECT startdt enddt sapweekno INTO TABLE it_date1 FROM zcalendar WHERE sapweekno GE s_week-low AND sapweekno LE s_week-high.
SORT by s_matnr p_werks.
LOOP AT it_date1.
SELECT * FROM pbhi INTO TABLE it_pbhi WHERE bdzei = pbim-bdzei AND ( pdatu GE it_date1-it_date1 AND pdatu LE it_date1-enddt ).
IF sy-subrc EQ 0.
DELETE it_pbhi WHERE aenam = 'ABBAU'.
LOOP AT it_pbhi.
it_ph = it_ph + it_pbhi-plnmg.
it_dm = it_dm + it_pbhi-dbmng.
ENDLOOP.
it_ph = it_ph - it_dm.
gt_pbed-matnr = s_matnr-low.
gt_pbed-plnmg = it_ph.
gt_pbed-perxx = it_date1-sapweekno.
APPEND gt_pbed.
CLEAR it_pbhi.
CLEAR it_ph.
CLEAR it_dm.
REFRESH it_pbhi.
CLEAR gt_pbed.
ELSE.
ENDIF.
ENDLOOP.
ENDSELECT.
ELSE.
SORT BY s_matnr p_werks.
LOOP AT s_matnr.
SELECT * FROM pbid WHERE matnr = s_matnr-low
AND werks = p_werks
AND loevr EQ space.
****PHANI
SELECT * FROM pbed WHERE bdzei = pbid-bdzei.
MOVE-CORRESPONDING pbed TO gt_pbed.
PERFORM convert_to_week USING pbed-pdatu
CHANGING gt_pbed-perxx.
check gt_pbed-perxx in r_week.
gt_pbed-matnr = pbid-matnr.
PERFORM GET_PARENT USING gt_bom-MATNR
CHANGING gt_pbed-p_matnr
GT_pbed-OJTXB.
COLLECT gt_pbed.
CLEAR gt_pbed.
*PHANI
data it_date1 type ZSTARTDT.
SELECT startdt enddt sapweekno INTO TABLE it_date1 FROM zcalendar WHERE sapweekno GE s_week-low AND sapweekno LE s_week-high.
LOOP AT it_date1.
SELECT * FROM pbhi INTO TABLE it_pbhi WHERE bdzei = pbid-bdzei AND ( pdatu GE it_date1-it_date1 AND pdatu LE it_date1-enddt ).
IF sy-subrc EQ 0.
DELETE it_pbhi WHERE aenam = 'ABBAU'.
LOOP AT it_pbhi.
it_ph = it_ph + it_pbhi-plnmg.
it_dm = it_dm + it_pbhi-dbmng.
ENDLOOP.
it_ph = it_ph - it_dm.
gt_pbed-matnr = s_matnr-low.
gt_pbed-plnmg = it_ph.
gt_pbed-perxx = it_date1-sapweekno.
APPEND gt_pbed.
CLEAR it_pbhi.
CLEAR it_ph.
CLEAR it_dm.
REFRESH it_pbhi.
CLEAR gt_pbed.
ELSE.
ENDIF.
ENDLOOP.
ENDSELECT.
ENDLOOP.
ENDIF.
ENDFORM. " get_pbid
*& Form convert_to_week
text
-->IV_DATE text
-->XV_WEEK text
FORM convert_to_week USING iv_date
CHANGING xv_week.
DATA : lv_week LIKE scal-week.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
date = iv_date
IMPORTING
week = lv_week.
xv_week = lv_week.
ENDFORM. "CONVERT_TO_WEEK
*& Form get_stock
text
FORM get_stock .
DATA : lv_stock LIKE mard-insme.
LOOP AT gt_pbed.
READ TABLE gt_stock WITH KEY matnr = gt_pbed-matnr.
CHECK sy-subrc NE 0.
SELECT SUM( labst ) INTO lv_stock FROM mard
WHERE matnr = gt_pbed-matnr AND werks = p_werks.
SELECT SUM( insme ) INTO gt_stock-stock FROM mard
WHERE matnr = gt_pbed-matnr AND werks = p_werks.
gt_stock-stock = gt_stock-stock + lv_stock.
gt_stock-matnr = gt_pbed-matnr.
APPEND gt_stock.
ENDLOOP.
ENDFORM. " get_stock
FORM s_week_days .
DELETE gt_pbed WHERE perxx < s_week-low. " and perxx > s_week-high.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val1.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val2.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val3.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val4.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val5.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val6.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val7.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val8.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val9.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val10.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val11.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val12.
s_week-low4(2) = s_week-low4(2) + 1.
CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val13.
ENDFORM. " s_week_days
*& Form build_fieldccatlog
text
FORM build_fieldcatlog .
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'MATNR'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = 'MATERIAL'.
APPEND gt_fieldcat1 TO gt_fieldcat.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WERKS'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_m = 'WERKS'.
APPEND gt_fieldcat1 TO gt_fieldcat.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'HEAD'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = 'REF'.
APPEND gt_fieldcat1 TO gt_fieldcat.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'STOCK'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = 'FG-STOCK'.
APPEND gt_fieldcat1 TO gt_fieldcat.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'BACKLOG'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = 'BACKLOG'.
APPEND gt_fieldcat1 TO gt_fieldcat.
dd = sy-datum+0(4).
cc = l_val1+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val1.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK1'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val1.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val2+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val2.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK2'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val2.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val3+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val3.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK3'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val3.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val4+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val4.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK4'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val4.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val5+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val5.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK5'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val5.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val6+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val6.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK6'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val6.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val7+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val7.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK7'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val7.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val8+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val8.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK8'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val8.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val9+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val9.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK9'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val9.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val10+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val10.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK10'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val10.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val11+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val11.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK11'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val11.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val12+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val12.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK12'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val12.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
CLEAR : cc,dd1.
cc = l_val13+5(2).
CONCATENATE dd cc INTO dd1.
LOOP AT it_zcalendar WHERE sapweekno = dd1.
CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val13.
CLEAR gt_fieldcat1.
gt_fieldcat1-fieldname = 'WEEK13'.
gt_fieldcat1-tabname = 'GT_OUT'.
gt_fieldcat1-seltext_l = l_val13.
APPEND gt_fieldcat1 TO gt_fieldcat.
ENDLOOP.
ENDFORM. " build_fieldccatlog
*& Form 13alv
text
FORM 13alv .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT =
it_fieldcat = gt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_out
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDFORM. " 13alv
*& Form gt_out
text
FORM gt_out .
LOOP AT s_matnr.
AT NEW low.
gt_out-matnr = s_matnr-low.
************BEGIN OF FIRST WEEK******************************
LOOP AT gt_pbed WHERE matnr = s_matnr-low AND perxx4(2) = l_val15(2).
gt_out-week1 = gt_pbed-plnmg.
LOOP AT it_zcalendar WHERE sapweekno = gt_pbed-perxx.
IF p_mov = '321'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '321'.
it_tot1 = it_tot1 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '322'.
it_tot1_2 = it_tot1_2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
ENDLOOP.
ENDIF.
IF p_mov = '101'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '101'.
it_tot1 = it_tot1 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '102'.
it_tot1_2 = it_tot1_2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
ENDLOOP.
ENDIF.
IF p_mov = '131'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '131'.
it_tot1 = it_tot1 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '132'.
it_tot1_2 = it_tot1_2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
ENDLOOP.
ENDIF.
CLEAR gt_pbed.
ENDLOOP.
ENDLOOP.
it_tot1 = it_tot1 - it_tot1_2.
it_back1 = gt_out-week1 - it_tot1.
CLEAR it_zcalendar.
END OF FIRST WEEK ************************
**********************SECOND WEEK***************************************
LOOP AT gt_pbed WHERE matnr = s_matnr-low AND perxx4(2) = l_val25(2).
int2 = int2 + 1.
CHECK int2 = 1.
gt_out-week2 = gt_pbed-plnmg.
LOOP AT it_zcalendar WHERE sapweekno = gt_pbed-perxx.
IF p_mov = '321'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '321'.
it_tot2 = it_tot2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '322'.
it_tot2_2 = it_tot2_2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
ENDLOOP.
ENDIF.
IF p_mov = '101'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '101'.
it_tot2 = it_tot2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '102'.
it_tot2_2 = it_tot2_2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
ENDLOOP.
ENDIF.
IF p_mov = '131'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '131'.
it_tot1 = it_tot1 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '132'.
it_tot1_2 = it_tot1_2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
ENDLOOP.
ENDIF.
CLEAR gt_pbed.
ENDLOOP.
ENDLOOP.
it_tot2 = it_tot2 - it_tot2_2.
it_back2 = gt_out-week2 - it_tot2.
it_back2 = it_back2 + it_back1.
CLEAR it_zcalendar.
********************************End of The Second week***********************************************
*********************Third week*************************************************************************
LOOP AT gt_pbed WHERE matnr = s_matnr-low AND perxx4(2) = l_val35(2).
int1 = int1 + 1.
CHECK int1 = 1.
gt_out-week3 = gt_pbed-plnmg.
LOOP AT it_zcalendar WHERE sapweekno = gt_pbed-perxx.
IF p_mov = '321'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '321'.
it_tot3 = it_tot3 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '322'.
it_tot3_2 = it_tot3_2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
ENDLOOP.
ENDIF.
IF p_mov = '101'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '101'.
it_tot3 = it_tot3 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '102'.
it_tot3_2 = it_tot3_2 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
ENDLOOP.
ENDIF.
IF p_mov = '131'.
LOOP AT it_mkpf WHERE budat GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '131'.
it_tot3 = it_tot3 + it_mseg-erfmg.
CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '132'.
it_tot3_2 = it_tot3_2 + it_mseg-erfmg.
My first question to you would be ...you have defined the plant code as parameters so you can enter multiple plants...change that to a select-option and you would be able to display all the results.
Regards
Anurag -
Want A query (Its Urgent)
Hi,I have a table as below..
AFPFTRAN
code date type amt
12 10-04-05 T 1
13 11-05-05 F 2
12 10-05-05 T 3
13 05-04-05 F 4
12 12-04-05 T 5
13 15-05-05 F 7
I want details as below:
date
Apr May ---
code T F T F ---
12 6 0 3 0
13 0 4 0 9
I want to get sum(amt) of T,F in particular month for particular emp.
Hope...I'm clear now...
Pls Its urgentuse something like following
select code, sum(decode(to_char(date, 'MM'), '01', decode(type, 'T', AMT, 0), 0)) Mon01_Type_T, sum(decode(to_char(date, 'MM', '02', decode(type, 'F', AMT, 0), 0)) Mon01_Type_F, .......(for all months and type)
from Your_table_name
group by code
I hope it will work the way you want,
Regards -
Decompiler problem of java class..its urgent. Please help
When trying to open a class through Java Decompiler, error message "jad.exe has encountered a problem and needs to close. We are sorry for inconvenience." is shown. The class file (when compiled through build ANT set-up) is getting corrupted for uknown reasons. However, when the same source is compiled through Jdev, the classfile is perfectly ok.
Note: Both the JDev and Build env are pointing to same jdk version (1.4.2)did you try to investigate the differences in the configurations for the ant build and the one with jdev?
-
Org Hierarchy Query(its urgent)
Hii Gurus,
Our client have the follwing requirement.
They need to see the parent node of the 0ORGUNIT in a separate column.
We do not know what it will take to accomplish this (enhancing 0ORGUNIT doesn't seem to be an option at this point),
Can u give me other options so that we can get.
As is:
Table
ClaenderYear/Month Organizational unit
JAN2008 60006395
JAN2008 20000000
JAN2008 20000026
JAN2008 20000040
To be:
Table
ClaenderYear/Month Organizational unit Parent Node
JAN2008 60006395
JAN2008 20000000 60006395
JAN2008 20000026 20000000
JAN2008 20000040 20000026
Thanks,
BabuYep that;s always the issue yeah when hierachy is activated in the report, all becomes messy.
0ORGunit is master data. Add another info object "ZPORGUNIT", then reference this to 0ORGUNIT.
Hope this helps. -
I have two columns(name and rank) in my table employee.
Data in the table as below:-
1) name= AAA and rank=1
2) name= AAA and rank=2
3) name= BBB and rank=3
4) name= BBB and rank=4 and so on...
I need to get only the 'name' having differnt 'ranks' (eg:- AAA has ranks 1 and 2 ).
Please assist asap.SELECT xx.NAME, xx.RANK
FROM (WITH t AS
(SELECT 'AAA' AS NAME, 1 AS RANK
FROM DUAL
UNION ALL
SELECT 'AAA' AS NAME, 2 AS RANK
FROM DUAL
UNION ALL
SELECT 'BBB' AS NAME, 3 AS RANK
FROM DUAL
UNION ALL
SELECT 'BBB' AS NAME, 4 AS RANK
FROM DUAL)
SELECT t.NAME, t.RANK,
ROW_NUMBER () OVER (PARTITION BY NAME ORDER BY RANK) AS rnk
FROM t) xx
WHERE xx.rnk = 1 -
How to run a SQL query which is stored in a column using PL/SQL?
Hello
I have a table A and one of the column values is select * from emp where empno :=xyz;
Now I would like to call this SQL query using a cursor in PL/SQL and run this for all the empno's and insert them into a temp table.
Can anybody help me in writing this PL/SQL query?
With Regards,
Mohanuser525114 wrote:
The primary reason for doing this is we are calculating percentiles on an entity sales for different range periods, and there are several sql queries stored in a cloumn, so we would like to know whether we can run these queries by calling them in a pl/sql query, Its not necessary that we need to use a cursor, but once fetching the result set of the query we would like to insert them in a table.Vamsi,
As said in response to Satya, executing dynamic SQL, looping over the result set and inserting the results one by one in a temporary table, is a horribly bad idea. Especially in terms of performance, but also regarding the maintainability of your code. It's just way more complex than necessary.
If you want to calculate percentages, then use analytic or aggregate functions in SQL to do so. If you want to store them, use a single INSERT SELECT statement.
If you want to continue on the same path, use Satya's code and use it inside a loop.
Regards,
Rob. -
MS Access queries different to Java SQL statements
Ok, i dont understand something:
My program is connected to a MSAccess datasource. The query in MSAccess is
SELECT *
FROM Food_Data
WHERE Description Like 'Cheese*';
...but this wont work with a Java SQl query. I have to use this instead:
String query = "SELECT * FROM Food_Data " +
"WHERE Description LIKE 'Cheese%'";
Surely java would just passes the string query to MSAccess. But no. Java needs '%' as the wildcard, and MSAccess needs '*' as the wildcard.
Can anyone please explain this to me?Well % is the standard wildcard character for SQL as defined by the ANSI standard. MS Access just doesn't conform to this standard.
Having said that, I'm still kind of astonished that it doesn't work :-)
The JDBC driver should pass the statement "as is" to the underlying DBMS, but obviously the JDBC/ODBC bridge does some "quirking". But maybe it
s the ODBC datasource. I can see a "ExtendedAnsiSQL" setting in one of my Access ODBC settings, maybe that changes something. -
Hello,
I have a big sql query with lot of subqueries, virtual column queries. When i run this SQL query, its returning the error message "single row subquery returns more than one row".
When i run it for individual employees, it runs fine but not sure for which employee its causing this error. Is there any way we can trace an SQL Query.
I appreciate your help - thanks
Thank You
KKWe can't provide much help outside of:
*ORA-01427: single-row subquery returns more than one row*
Cause: The outer query must use one of the keywords ANY, ALL, IN, or NOT IN to specify values to compare because the subquery returned more than one row.
Action: Use ANY, ALL, IN, or NOT IN to specify which values to compare or reword the query so only one row is retrieved.
>
This error means that a subquery was expecting a single row, but more than one was returned. You can take that subquery and try and run it on it's own for each case (if the result set is small) to see which case is causing multiple rows to be returned. If it's a large set you can take advantage of aggregate functions like COUNT(*) to determine which is returning multiple rows.
If you need additional help please see: {message:id=9360002}
Edited by: Centinul on Dec 16, 2011 2:13 PM -
Validate and Edit SQL Query Errors
I am trying to "Validate or Edit SQL Query" in APEX 3.0. When I open up the SQL Query its highlighted in red and when I click on the Validate or Edit button it gives me an error.
I modified my marvel.conf file to include:
AddType text/xml xbl
AddType text/x-component htc
and this still didnt take care of it. Any ideas and thank you in advance.
PS: OPS - Windows Server 2003
Upgraded from 1.6 to 3.0I've gotten so used to command line editing, that I rarely us "ed". back in the days of DOS, the default editor was EDLIN - one of those goofy editors that only showed one line at a time, so it wasn't much of an improvement. you could switch to the old dos editor, but that wasn't much better (just checked, it's still there)
some nice things with command line editing
to change everthing between the first two single quotes
c/'...'/'new criteria'to remove everything after a specific string
c/from.../fromto change a string that contains (or will contain) slashes
c.1/2.1/4. -
Need a SQL query(Pls Its urgent)
Hi,
I want a SQL query for the foll..
Details r below..
Table AFPFTRAN
BU TRansactiondate Amt
13202 10-04-05 10,000
13203 11-05-05 20,000
13202 20-04-05 5,000
Table AFGENCOD
BU Clerk Name Clerk Code
13202 Amit TFBG
13203 Anand TFMG
I want a query to get data as below..
Tr Date TFBG TFMG
Apr 15,000 0
May 0 20,000
JUn 0 0
Jul 0 0
Aug
Sep
Aug
Nov
DEc
Jan
Feb
Mar
I want this to achieve using a single query...?How can I achive this?
Pls give the sol...
Adios...
Prashanth DeshmukhDoes it look like you need ?
SQL> select * from t;
BU TDATE AMT
13202 10.04.05 10000
13203 11.05.05 20000
13202 20.04.05 5000
SQL> select * from t1;
BU NAME CODE
13202 Amit TFBG
13203 Anand TFMG
SQL> SELECT pivot_month.mname, tops.TFBG, tops.TFMG
2 from
3 (
4 select to_char(t.tdate,'MM') month_no,
5 sum(decode(t1.code,'TFBG',t.amt,0)) TFBG,
6 sum(decode(t1.code,'TFMG',t.amt,0)) TFMG
7 from t1, t
8 where t.bu=t1.bu
9 and to_char(t.tdate,'yyyy') = 2005
10 GROUP BY t1.code, to_char(t.tdate,'MM')
11 ) tops,
12 (select rownum mn, to_char(to_date(rownum,'MM'),'MON') mname,
13 case when rownum between 1 and 3 then rownum + 9
14 else rownum - 3 end rn
15 from dict where rownum < 13) pivot_month
16 where pivot_month.mn = tops.month_no (+)
17 order by pivot_month.rn
18 /
MNA TFBG TFMG
APR 15000 0
MAY 0 20000
JUN
JUL
AUG
SEP
OCT
NOV
DEC
JAN
FEB
MAR
12 rows selected.Rgds. -
Java.sql.SQLException: ORA-00933: error when executing query
Hello,
I am trying to execute the following query from a jsp page.
String sqlUpdate ="UPDATE table_name SET name ='"+name+"', description='"+description+"', proj_link='" projlink"', active='" active"',sort_order='" order"',image='" image"',category='" category"', technology='" technology "' WHERE id="+id+" ";
stmt.executeQuery(sqlUpdate);
I get the follwoing error java.sql.SQLException: ORA-00933: SQL command not properly ended
When I omit "description" from the query it executes fine. But when I place it back into the query I get the above error. The table is in Oracle database and the datatype of description id varchar2(4000). I declared all the variables used in the query, I then assigned values caught from the form and then am trying to update the form varibles in the table.
Thanks,
Nikky128Nikky128 wrote:
Hello,
I am trying to execute the following query from a jsp page.There's a big part of your problem. You shouldn't be doing database stuff in JSPs. If you must, you should be using JSTL and its <sql> tags.
String sqlUpdate ="UPDATE table_name SET name ='"+name+"', description='"+description+"', proj_link='" projlink"', active='" active"',sort_order='" order"',image='" image"',category='" category"', technology='" technology "' WHERE id="+id+" ";Not using PreparedStatement here is just a silly noob error.
When I omit "description" from the query it executes fine. But when I place it back into the query I get the above error. The table is in Oracle database and the datatype of description id varchar2(4000). I declared all the variables used in the query, I then assigned values caught from the form and then am trying to update the form varibles in the table.Probably a single or double quote that you can't see. PreparedStatement will eliminate that problem.
%
Maybe you are looking for
-
HP Color LaserJet CP1210 photoprints creating shadows
HP Color LaserJet CP1210 print I have a problem on the CP 1210. On the self test / configuration page the left hand 90 degree corner with the black dot on the inside corner is not regular compared to the same graphic on the right side of the page. A
-
MRP with Subcontracting (Urgent)
Hi, I have a scenario of Subcontracting in an Automobile Industry. The planning plant is I005 and the BOm is as follows - Final Assy 'FA' (FERT) {Assembly done on subcontract basis by subcontract Vendor A005) -- Sub Assy 01 'SA1' (HALB) - {Assembly d
-
Cannot export movie files from iPhoto 11 (9.5)
Hi. Am not able to export movies from iPhoto 11. I leave the type as Original and get an error - see screenshot. Running on Mavericks and up-to-date iPhoto. Have tried to export to multiple places so hard drive space, etc. isn't the problem. Can expo
-
Hi. I am unfamiliar with the Soundtrack interface. I have been editing a lot of sound for a short film in final cut pro. We recorded a large amount of audio for monsters and people, ect. I have the file of all that audio in an OMF file which I can on
-
hi, I just noticed that my systemctl and journalctl all return nothing, when I try to strace them write(1, "UNIT "..., 4096) = -1 EPIPE (Broken pipe) --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=581, si_uid=0} ---