Debit billings--select statement
Hi,
I am preparing one alv report related to FI module.There is one colomn called Debit billings.
The explanation given for that colomn
" Document types RV and DR which debit accounts 110000 , 110500 , 110900 and credit accounts 400000 to 401000 .
Can any one tell me how to write the select statement for this colomn.
From where i have to fetch the data.
thanks
ansari
Hi ,
I did not understand your answer completely. I am dealing with accoutns receivable.So i was thinking i will be coming from BISD which deals with open customers.
Can you please explain to me this
<b>entry like this
40 customer 100/-
50 g/l 100/-
in BSIS u will get only 40-100/- only , u wont get 50-100/- , so u have to goto BSEG to get g/l 50-100.
</b>
Thanks
Ansari
Similar Messages
-
Passing variable in a select statement
Everything about this query works except I'm trying to capture the @companyid (which is a variable) into a column in my table via my select statement.
My error is Invalid column name 'A113', etc. However it is the A113 I'm trying to insert into the first column of the table SAP_GLsummary
Can someone fix my syntax so this works.
-- retrieves a list of gl balances from all companies
truncate table sap_glsummary
declare @companyID char(6)
declare c_company cursor for
select INTERID from dbo.GP_Interid
open c_company fetch next from c_company into @companyID
while @@fetch_status = 0
begin
insert into SAP_GLsummary
exec ('select ' + @companyID + ' , [Year],[Period ID],[Account Number],[Account Description],[Credit Amount],[Debit Amount]
FROM ' +'cgygp01.'+ @companyID + '.dbo.AccountSummary')
fetch next from c_company into @companyID
end
close c_company
deallocate c_companyTry
- retrieves a list of gl balances from all companies
truncate table sap_glsummary
declare @companyID char(6)
declare c_company cursor for
select INTERID from dbo.GP_Interid
open c_company fetch next from c_company into @companyID
while @@fetch_status = 0
begin
insert into SAP_GLsummary (Col1, Col2, ...)
exec ('select ' + quotename(@companyID,'''') + ' , [Year],[Period ID],[Account Number],[Account Description],[Credit Amount],[Debit Amount]
FROM ' +'cgygp01.'+ quotename(@companyID) + '.dbo.AccountSummary')
fetch next from c_company into @companyID
end
close c_company
deallocate c_company
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
Trouble on launch a select statement twice
Hello everyone,
this is my problem: when i launch this query the first time, it returns 2 records, if i launch it the second time it returns no records.
I tried to remove SUM(NVL) and the group by and the query functions normally.
select SUM (NVL (a.burdened_cost, 0)) AS amount ,c.track_as_labor_flag,a.start_date, a.end_date
FROM nome_vista a, nome_tabella b,nome_tabella c
WHERE a.project_id = ...
AND a.task_id = ...
AND a.budget_version_id = b.budget_version_id
AND NVL (b.current_flag, 'N') = 'Y'
AND b.budget_status_code = ...
AND b.budget_type_code = ...
AND c.track_as_labor_flag = ... --filtro costi interni
AND c.resource_id = a.resource_id
Group By c.track_as_labor_flag,a.start_date, a.end_dateThank You
Edited by: BluShadow on 27-Jul-2011 13:52
added {noformat}{noformat} tags for readability. Please see {message:id=9360002} to learn to do this yourself.SQL> set autotrace on;
SQL> SQL> select SUM (NVL (a.burdened_cost, 0)) AS amount
,c.track_as_labor_flag
,a.start_date
,a.end_date
2 FROM pa_budget_lines_v a,
3 pa_budget_versions b,
4 pa_resource_list_members c
5 WHERE a.project_id = 1879
6 AND a.task_id = 211004
7 AND a.budget_version_id = b.budget_version_id
8 AND NVL (b.current_flag, 'N') = 'Y'
9 AND b.budget_status_code = 'B'
10 AND b.budget_type_code = 'AC'
11 AND c.track_as_labor_flag = 'Y' --filtro costi interni
12 AND c.resource_id = a.resource_id
13 Group By c.track_as_labor_flag,a.start_date, a.end_date;
AMOUNT T START_DA END_DATE
2919,2 Y 10-07-01 10-12-31
945,36 Y 10-01-01 11-01-31
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 1 | 161 | 19 (11)|
| 1 | HASH GROUP BY | | 1 | 161 | 19 (11)|
|* 2 | HASH JOIN | | 1 | 161 | 18 (6)|
| 3 | NESTED LOOPS OUTER | | 1 | 154 | 11 (0)|
| 4 | NESTED LOOPS | | 1 | 118 | 10 (0)|
| 5 | NESTED LOOPS | | 1 | 91 | 8 (0)|
| 6 | NESTED LOOPS | | 1 | 79 | 7 (0)|
| 7 | NESTED LOOPS OUTER | | 1 | 67 | 6 (0)|
|* 8 | TABLE ACCESS BY INDEX ROWID| PA_RESOURCE_ASSIGNMENTS | 1 | 31 | 5 (0)|
|* 9 | INDEX RANGE SCAN | PA_RESOURCE_ASSIGNMENTS_N2 | 6 | | 1 (0)|
|* 10 | INDEX UNIQUE SCAN | FND_LOOKUP_VALUES_U1 | 1 | 36 | 1 (0)|
|* 11 | TABLE ACCESS BY INDEX ROWID | PA_BUDGET_VERSIONS | 1 | 12 | 1 (0)|
|* 12 | INDEX UNIQUE SCAN | PA_BUDGET_VERSIONS_U1 | 1 | | 0 (0)|
|* 13 | TABLE ACCESS BY INDEX ROWID | PA_RESOURCE_LIST_MEMBERS | 1 | 12 | 1 (0)|
|* 14 | INDEX UNIQUE SCAN | PA_RESOURCE_LIST_MEMBERS_U1 | 1 | | 0 (0)|
| 15 | TABLE ACCESS BY INDEX ROWID | PA_BUDGET_LINES | 1 | 27 | 2 (0)|
|* 16 | INDEX RANGE SCAN | PA_BUDGET_LINES_N2 | 1 | | 1 (0)|
|* 17 | INDEX UNIQUE SCAN | FND_LOOKUP_VALUES_U1 | 1 | 36 | 1 (0)|
|* 18 | TABLE ACCESS FULL | PA_RESOURCE_LIST_MEMBERS | 121 | 847 | 6 (0)|
Predicate Information (identified by operation id):
2 - access("C"."RESOURCE_ID"="M"."RESOURCE_ID")
8 - filter("A"."PROJECT_ID"=1879)
9 - access("A"."TASK_ID"=211004)
10 - access("LOOKUP_TYPE"(+)='UNIT' AND "VIEW_APPLICATION_ID"(+)=275 AND
"A"."UNIT_OF_MEASURE"="LOOKUP_CODE"(+) AND "SECURITY_GROUP_ID"(+)=
0 AND
"LANGUAGE"(+)=USERENV('LANG'))
11 - filter("B"."BUDGET_STATUS_CODE"='B' AND "B"."CURRENT_FLAG"='Y' AND
"B"."BUDGET_TYPE_CODE"='AC')
12 - access("A"."BUDGET_VERSION_ID"="B"."BUDGET_VERSION_ID")
13 - filter(NVL("M"."MIGRATION_CODE",'-99')<>'N')
14 - access("A"."RESOURCE_LIST_MEMBER_ID"="M"."RESOURCE_LIST_MEMBER_ID")
16 - access("I"."RESOURCE_ASSIGNMENT_ID"="A"."RESOURCE_ASSIGNMENT_ID")
17 - access("LOOKUP_TYPE"(+)='BUDGET CHANGE REASON' AND "VIEW_APPLICATION_ID"(
+)=275 AND
"I"."CHANGE_REASON_CODE"="LOOKUP_CODE"(+) AND "SECURITY_GROUP_ID"(
+)=0 AND
"LANGUAGE"(+)=USERENV('LANG'))
18 - filter("C"."TRACK_AS_LABOR_FLAG"='Y')
Note
--- 'PLAN_TABLE' is old version
Statistics
22 recursive calls
0 db block gets
145 consistent gets
21 physical reads
0 redo size
574 bytes sent via SQL*Net to client
337 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
SQL> select SUM (NVL (a.burdened_cost, 0)) AS amount
,c.track_as_labor_flag
,a.start_date
,a.end_date
2 FROM pa_budget_lines_v a,
3 pa_budget_versions b,
4 pa_resource_list_members c
5 WHERE a.project_id = 1879
6 AND a.task_id = 211004
7 AND a.budget_version_id = b.budget_version_id
8 AND NVL (b.current_flag, 'N') = 'Y'
9 AND b.budget_status_code = 'B'
10 AND b.budget_type_code = 'AC'
11 AND c.track_as_labor_flag = 'Y' --filtro costi interni
12 AND c.resource_id = a.resource_id
13 Group By c.track_as_labor_flag,a.start_date, a.end_date;
no rows selected
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 1 | 161 | 19 (11)|
| 1 | HASH GROUP BY | | 1 | 161 | 19 (11)|
|* 2 | HASH JOIN | | 1 | 161 | 18 (6)|
| 3 | NESTED LOOPS OUTER | | 1 | 154 | 11 (0)|
| 4 | NESTED LOOPS | | 1 | 118 | 10 (0)|
| 5 | NESTED LOOPS | | 1 | 91 | 8 (0)|
| 6 | NESTED LOOPS | | 1 | 79 | 7 (0)|
| 7 | NESTED LOOPS OUTER | | 1 | 67 | 6 (0)|
|* 8 | TABLE ACCESS BY INDEX ROWID| PA_RESOURCE_ASSIGNMENTS | 1 | 31 | 5 (0)|
|* 9 | INDEX RANGE SCAN | PA_RESOURCE_ASSIGNMENTS_N2 | 6 | | 1 (0)|
|* 10 | INDEX UNIQUE SCAN | FND_LOOKUP_VALUES_U1 | 1 | 36 | 1 (0)|
|* 11 | TABLE ACCESS BY INDEX ROWID | PA_BUDGET_VERSIONS | 1 | 12 | 1 (0)|
|* 12 | INDEX UNIQUE SCAN | PA_BUDGET_VERSIONS_U1 | 1 | | 0 (0)|
|* 13 | TABLE ACCESS BY INDEX ROWID | PA_RESOURCE_LIST_MEMBERS | 1 | 12 | 1 (0)|
|* 14 | INDEX UNIQUE SCAN | PA_RESOURCE_LIST_MEMBERS_U1 | 1 | | 0 (0)|
| 15 | TABLE ACCESS BY INDEX ROWID | PA_BUDGET_LINES | 1 | 27 | 2 (0)|
|* 16 | INDEX RANGE SCAN | PA_BUDGET_LINES_N2 | 1 | | 1 (0)|
|* 17 | INDEX UNIQUE SCAN | FND_LOOKUP_VALUES_U1 | 1 | 36 | 1 (0)|
|* 18 | TABLE ACCESS FULL | PA_RESOURCE_LIST_MEMBERS | 121 | 847 | 6 (0)|
Predicate Information (identified by operation id):
2 - access("C"."RESOURCE_ID"="M"."RESOURCE_ID")
8 - filter("A"."PROJECT_ID"=1879)
9 - access("A"."TASK_ID"=211004)
10 - access("LOOKUP_TYPE"(+)='UNIT' AND "VIEW_APPLICATION_ID"(+)=275 AND
"A"."UNIT_OF_MEASURE"="LOOKUP_CODE"(+) AND "SECURITY_GROUP_ID"(+)=
0 AND
"LANGUAGE"(+)=USERENV('LANG'))
11 - filter("B"."BUDGET_STATUS_CODE"='B' AND "B"."CURRENT_FLAG"='Y' AND
"B"."BUDGET_TYPE_CODE"='AC')
12 - access("A"."BUDGET_VERSION_ID"="B"."BUDGET_VERSION_ID")
13 - filter(NVL("M"."MIGRATION_CODE",'-99')<>'N')
14 - access("A"."RESOURCE_LIST_MEMBER_ID"="M"."RESOURCE_LIST_MEMBER_ID")
16 - access("I"."RESOURCE_ASSIGNMENT_ID"="A"."RESOURCE_ASSIGNMENT_ID")
17 - access("LOOKUP_TYPE"(+)='BUDGET CHANGE REASON' AND "VIEW_APPLICATION_ID"(
+)=275 AND
"I"."CHANGE_REASON_CODE"="LOOKUP_CODE"(+) AND "SECURITY_GROUP_ID"(
+)=0 AND
"LANGUAGE"(+)=USERENV('LANG'))
18 - filter("C"."TRACK_AS_LABOR_FLAG"='Y')
Note
- 'PLAN_TABLE' is old version
Statistics
22 recursive calls
2 db block gets
9 consistent gets
0 physical reads
0 redo size
416 bytes sent via SQL*Net to client
326 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processedEdited by: -deb- on 28-lug-2011 2.44
Edited by: BluShadow on 28-Jul-2011 10:57
added {noformat}{noformat} tags again! This is the last time I'll do it for you. -
If statement in select statement alias
I have the following select statement. It has the alias Survivors, Deaths and "All Cases". Is it posible to use :P_LANGUAGE variable to say that -- IF :P_LANGUAGE = FRENCH THEN alias are Survivants for survivors, Décès for Deaths, Tous_les_cas for All Cases. Please advise
SELECT ALL T_NTR_MULTIBAR.CAT, T_NTR_MULTIBAR.NUM_CASES_LEFTBAR AS Survivors,
T_NTR_MULTIBAR.NUM_CASES_MIDDLEBAR AS Deaths, T_NTR_MULTIBAR.NUM_CASES_RIGHTBAR AS "All Cases"
FROM T_NTR_MULTIBAR
WHERE INSTANCE_NUM = :P_INSTANCENUM
order by ORDERSYou may not be able to add this condition inside the SQL Statement. But you can add this condition outside the statement, if you're using PL/SQL...
IF :p_language = french THEN
SELECT ALL t_ntr_multibar.cat,
t_ntr_multibar.num_cases_leftbar AS survivors,
t_ntr_multibar.num_cases_middlebar AS deaths,
t_ntr_multibar.num_cases_rightbar AS "All Cases"
ELSE
END IF; -
How to get all values from an interval using select statement
Hi,
Is it possible to write a select statement that returns all values from an interval? Interval boundaries are variable.
something like this:
select (for x in 1,1024 loop x end loop) from dual
(this, of course, doesn't work)
The result in this example should be 1024 rows of numbers from 1 to 1024. These numbers are parameters, so it is not possible to create a table with predefined values.
Thanks in advance for your help,
Mia.For your simple case, with a lower boundary of 1, you can use:
SELECT rownum
FROM all_objects
WHERE rownum <= 1024For a set of number between say 50 - 100, you can use something like:
SELECT rownum + (50 - 1)
FROM all_objects
WHERE rownum <= (100 - 50 + 1)Note, that all_objects was used only because it generally has a lot of rows. Any table with at least the number of rows in your range will work.
TTFN
John -
Select statement operators in ecc 6.
Hi Experts,
I have a small doubt about the '>=' ( greater than or equal to ) operator usage in select statement. Is this operator by any chance perform not as desired in ECC 6.0. Is it a good option to use 'GE' instead of '>='. ?
It may sound a bit awkward, but still I would like to know. I am facing a situation, which could be related to this. An early response would be highly appreciated.
I would request,you NOT TO REPLY with links/explanations which says how to use select statement. Only answer if you have the answers related to this query.
Regards,
Sandipan>
Jaideep Sharma wrote:
> Hi,
> The only difference is GE will take a little more time than >= as system need to convert the keyword into actual operator when fetching data from Database.
>
> KR Jaideep,
????? Every Open SQL statements is translated to the SQL slang the underlying database is talking regardless if you type GE or >=
If the result differs using >= or GE i would open a call at SAP instead of asking in SDN. -
How to find the number of fetched lines from select statement
Hi Experts,
Can you tell me how to find the number of fetched lines from select statements..
and one more thing is can you tell me how to check the written select statement or written statement is correct or not????
Thanks in advance
santoshHi,
Look for the system field SY_TABIX. That will contain the number of records which have been put into an internal table through a select statement.
For ex:
data: itab type mara occurs 0 with header line.
Select * from mara into table itab.
Write: Sy-tabix.
This will give you the number of entries that has been selected.
I am not sure what you mean by the second question. If you can let me know what you need then we might have a solution.
Hope this helps,
Sudhi
Message was edited by:
Sudhindra Chandrashekar -
Use of LIKE in where clause of select statement for multiple records
Hi Experts,
I have a account number field which is uploaded from a file. Now this account numbers uploaded does not match fully with sap table account numbers but it contains all of the numbers provided in the file mostly in the upright positions.
For example in file we have account number as 2ARS1 while in sap table the value is 002ARS1.
And i want to fetch data from sap table based on account number uploaded. So, i am trying to use LIKE with for all entries but its not working as mentioned below but LIKE is not working with FOR ALL ENTRIES.
data : begin of t_dda occurs 0,
dda(19) type c,
end of t_dda.
data : begin of t_bukrs occurs 0,
bukrs type t012k-bukrs,
end of t_bukrs.
data : dda type t012k-bankn,
w_dda type t012k-bankn.
CONCATENATE '%'
'2ARS1'
INTO W_DDA.
MOVE W_DDA TO T_DDA-DDA.
APPEND T_DDA.
CLEAR T_DDA.
free t_bukrs.
SELECT BUKRS
FROM T012K
into TABLE t_bukrs
for all entries in t_dda
WHERE BANKN like t_dda-dda.
Can anybody suggest what should i use to get the data for multiple account numbers using one select statement only instead on using SELECT UP TO 1 ROWS in LOOP....ENDLOOP ?
Thanks in advance,
AkashHi,
yes, For All entries won't work for LIKE with '% '.
I think the other alternative is go for Native SQL by writing sub-query
sample code is here:
data: begin of i_mara occurs 0,
matnr like mara-matnr,
matkl like mara-matkl,
end of i_mara.
exec sql.
select matnr, matkl from mara where matnr in (select matnr from marc) and matnr like '%ma' into :i_mara
endexec.
loop at i_mara.
write:/ i_mara-matnr, i_mara-matkl.
endloop.
hope u got it.
regards
Mahesh
Edited by: Mahesh Reddy on Jan 21, 2009 2:32 PM -
What is the use of additon in up to 1 rows in SELECT statement
Hi All,
What is the use of up to 1 rows in select statement.
for example
SELECT kostl
FROM pa0001
INTO y_lv_kostl UP TO 1 ROWS
WHERE pernr EQ pernr
AND endda GE sy-datum.
ENDSELECT.
I'm unable to get in wat situations we hav to add up to 1 rows
please help me out...
Thanks,
santosh.Hi,
Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.
Regards,
Bhaskar -
Secondary Index Select Statement Problem
Hi friends.
I have a issue with a select statement using secondary index,
SELECT SINGLE * FROM VEKP WHERE VEGR4 EQ STAGE_DOCK
AND VEGR5 NE SPACE
AND WERKS EQ PLANT
%_HINTS ORACLE
'INDEX("&TABLE&" "VEKP~Z3" "VEKP^Z3" "VEKP_____Z3")'.
given above statement is taking long time for processing.
when i check for the same secondary index in vekp table i couldn't see any DB index name with vekp~z3 or vekp^z3 or vekp____z3.
And the sy-subrc value after select statement is 4. (even though values avaliable in VEKP with given where condition values)
My question is why my select statement is taking long time and sy-subrc is 4?
what happens if a secnodary index given in select statement, which is not avaliable in that DB Table?Hi,
> ONe more question: is it possible to give more than one index name in select statement.
yes you can:
read the documentation:
http://download.oracle.com/docs/cd/A97630_01/server.920/a96533/hintsref.htm#5156
index_hint:
This hint can optionally specify one or more indexes:
- If this hint specifies a single available index, then the optimizer performs
a scan on this index. The optimizer does not consider a full table scan or
a scan on another index on the table.
- If this hint specifies a list of available indexes, then the optimizer
considers the cost of a scan on each index in the list and then performs
the index scan with the lowest cost. The optimizer can also choose to
scan multiple indexes from this list and merge the results, if such an
access path has the lowest cost. The optimizer does not consider a full
table scan or a scan on an index not listed in the hint.
- If this hint specifies no indexes, then the optimizer considers the
cost of a scan on each available index on the table and then performs
the index scan with the lowest cost. The optimizer can also choose to
scan multiple indexes and merge the results, if such an access path
has the lowest cost. The optimizer does not consider a full table scan.
Kind regards,
Hermann -
BI Publisher : SELECT statement in RTF template
Hi Guys
I have written a BI Publisher Report using XML file created from Oracle Reports(in Oracle Apps).
Repors runs from Oracle Apps perfectly ok. Now I need to fetch some data from couple of tables and display on the Report.
I am wondering whether I can directly code SELECT statement in RTF file rather than messing with Oracle Report(.rdf) file.
Please advise.
Thanks and Regards
VijayHey Vijay,
You cannot query in RTF using select :)..
You have to mess/play with RDF to do it ;)
Oh wait, did i say , we cannot in RTF, we can , but that is difficult approach to go with., keep this as an end of the world option. -
Can we use is null in our select statement in ABAP program
hi,
I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data. Can anyone resolve this.Hi,
I think you've posted your question on the wrong forum. This is the SAP Business One development forum which is not part of ERP and doesn't include any ABAP or Netweaver programming.
For a list of forums please see here:
http://forums.sdn.sap.com/index.jspa
Kind Regards,
Owen -
Performance issue - Select statement
Hi I am having the 10 lack records in the KONP table . If i am trying to see all the records in SE11 , it is giving the short dump TSV_TNEW_PAGE_ALLOC_FAILED . I know this is because of less memory in the Server . Is there any other way to get the data ? How to optimise the below SELECT statement if i have large data in the table .
i_condn_data - is having 8 lack records .
SELECT knumh kznep valtg valdt zterm
FROM konp
INTO TABLE i_condn_data_b
FOR ALL ENTRIES IN i_condn_data
WHERE knumh = i_condn_data-knumh
AND kschl = p_kschl.
Please suggest .Hi,
try to use "UP TO n ROWS" to control the quantity of selected data in each Loop step.
Something like this:
sort itab by itab-knumh.
flag = 'X'.
while flag = 'X'.
SELECT knumh kznep valtg valdt zterm
FROM konp
INTO TABLE i_condn_data_b UP TO one_million ROWS
WHERE knumh > new_value_for_selection
AND kschl = p_kschl.
describe table i_condn_data_b lines i.
read table i_condn_data_b index i.
new_value_for_selection = i_condn_data_b-knumh.
*....your logic for table i_condn_data_b
if one_million > i.
clear flag.
endif.
endwhile.
Regards -
Retrieving multiple values from one column in SELECT statement
Hi,
I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
e.g.
at the DB level :
SELECT role_name, CC_ID FROM votetbl a
INNER JOIN APPROVERS b ON
a.BUSVP = b.BUSVP AND
a.BRANCH = b.BRANCH
WHERE CC_ID = 1688this will return:
ROLE_NAME CC_ID
ops 1688
ops 1688
comply 1688
legal 1688
comply 1688
When run in my JSP, like so:
String primID3a = request.getParameter("primID");
Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
"a.BRANCH = b.BRANCH WHERE CC_ID = ?";
PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
prepvotstmt.setString(1, primID3a);
ResultSet rest3 = prepvotstmt.executeQuery();
rest3.next();
String votecat = rest3.getString(1);
out.println("Vote category: "+votecat);I only get ops returned.
Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
Any feedback and direction here is welcomed!
Thanks!Actually, I tried looping and still only get 1, but returned several times.
i.e.
PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
prepvotstmt.setString(1, primID3a);
ResultSet rest3 = prepvotstmt.executeQuery();
rest3.next();
String votecat = rest3.getString(1);
while (rest3.next()) {
out.print("category roles "+votecat);
}then I get returned the following:
admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
like so.
Where as at the DB level I get
ROLE_NAME CC_ID
admin 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
ops 1688
risk 1688
comply 1688
legal 1688
legal 1688
ops 1688
comply 1688
Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
Other times, it will not return a value at all, even though one resides in the db.
Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
Yeeeeeeesh!!! : (
Message was edited by:
bpropes20 -
I m trying to find if LIMIT is a part of the select statement and if works like
set rowcount 1 in sybase....if anyone can post the generic select statement with LIMIT in it that would be great!
any help or input will be greatly appreciated
Thanks!Hallo,
i don't know sybase, but it is probably rownum
select * from scott.emp
where rownum < 3
Regards
Dmytro
Maybe you are looking for
-
This problem is a recent one (only has happened in the past 2-3 weeks). When I shut the lid it used to immediately sleep (the power light began to do its fade in and out, and the backlight turned off), but now when I close the lid, the power light st
-
[SOLVED] How to automatically mount USB drives with custom mount point
edit: Original title was : 'Unable to mount USB disk via /etc/rc.local', but got changed since the /etc/rc.local problem isn't relevant for me anymore. Hello, Since I am new to this forum, I'll start off with this : Thanks to archlinux, its founder a
-
SAP B1 APPLICATION IS RUNNING SLOW IN SERVER AFTER UPGRADE
Hi, The sap application is running slow in server after upgrading it from 9.0 to 9.1 it's taking 5-10 secs to open a document after clicking it and its taking more time in client system. what are the steps to be taken so that the application will run
-
Query Transported Successfully : But transported query is not available in PRD system
Hi Gurus, I have transported one query yesterday. And transport got successful with out any errors. Now i am checking the same query in PRD system, but i am not able to find the query. Checked in RSRT and Query Designer in PRD System. Table RSZCOMPDI
-
How can I access BBC i player, ITV player, 4OD and other on demand catch-up services in the UK using my new Apple TV?