Correct format for a prepared statement.
Statement myStmt = myCon.createStatement();
String sqlQuery = "SELECT * FROM customer WHERE custName='" + name + "'";
ResultSet mRs = myStmt.executeQuery(sqlQuery);
String sqlQuery = "SELECT * FROM customer WHERE custName= ? ";
PreparedStatement myStmt = myCon.prepareStatement(sqlQuery);
myStmt.setString(1, name);
ResultSet mRs = myStmt.executeQuery(sqlQuery);Is this correct to change the statement into a prepared statement? Because it doen't work, been looking at the prepared statement API and managed to convert my update statement.
>
String sqlQuery = "SELECT * FROM customer WHERE
custName= ? ";
PreparedStatement myStmt =
myCon.prepareStatement(sqlQuery);
myStmt.setString(1, name);
ResultSet mRs = myStmt.executeQuery(sqlQuery);Is this correct to change the statement into a
prepared statement? Because it doen't work, been
looking at the prepared statement API and managed to
convert my update statement.Try running the java.sql.PreparedStatement.executeQuery() method that doesn't take any arguments:
ResultSet mRs = myStmt.executeQuery();MOD
ResultSet mRs = myStmt.executeQuery(sqlQuery);
Similar Messages
-
BAI format for Electronic Bank Statement for USA
Hi Gurus,
Could someone please share me the BAI format for Electronic Bank Statement (USA).
Thanks & Regards
BalajiHi
Actually there were two formats BAI & BAI2, BAI2 format is latest one.
Please ask for the latest file from bank and try to process.
Thanks
Kalyan -
Can't figure out the correct syntax for this select statement
Hello,
The following statement works great and gives the desired results:
prompt
prompt Using WITH t
prompt
with t as
select a.proj_id,
a.proj_start,
a.proj_end,
case when (
select min(a.proj_start)
from v b
where (a.proj_start = b.proj_end)
and (a.proj_id != b.proj_id)
is not null then 0 else 1
end as flag
from v a
order by a.proj_start
select proj_id,
proj_start,
proj_end,
flag,
-- the following select statement is what I am having a hard time
-- "duplicating" without using the WITH clause
select sum(t2.flag)
from t t2
where t2.proj_end <= t.proj_end
) s
from t;As an academic exercise I wanted to rewrite the above statement without using the WITH clause, I tried this (among dozens of other tries - I've hit a mental block and can't figure it out):
prompt
prompt without with
prompt
select c.proj_id,
c.proj_start,
c.proj_end,
c.flag,
-- This is what I've tried as the equivalent statement but, it is
-- syntactically incorrect. What's the correct syntax for what this
-- statement is intended ?
select sum(t2.flag)
from c t2
where t2.proj_end <= c.proj_end
) as proj_grp
from (
select a.proj_id,
a.proj_start,
a.proj_end,
case when (
select min(a.proj_start)
from v b
where (a.proj_start = b.proj_end)
and (a.proj_id != b.proj_id)
is not null then 0 else 1
end as flag
from v a
order by a.proj_start
) c;Thank you for helping, much appreciated.
John.
PS: The DDL for the table v used by the above statements is:
drop table v;
create table v (
proj_id number,
proj_start date,
proj_end date
insert into v values
( 1, to_date('01-JAN-2005', 'dd-mon-yyyy'),
to_date('02-JAN-2005', 'dd-mon-yyyy'));
insert into v values
( 2, to_date('02-JAN-2005', 'dd-mon-yyyy'),
to_date('03-JAN-2005', 'dd-mon-yyyy'));
insert into v values
( 3, to_date('03-JAN-2005', 'dd-mon-yyyy'),
to_date('04-JAN-2005', 'dd-mon-yyyy'));
insert into v values
( 4, to_date('04-JAN-2005', 'dd-mon-yyyy'),
to_date('05-JAN-2005', 'dd-mon-yyyy'));
insert into v values
( 5, to_date('06-JAN-2005', 'dd-mon-yyyy'),
to_date('07-JAN-2005', 'dd-mon-yyyy'));
insert into v values
( 6, to_date('16-JAN-2005', 'dd-mon-yyyy'),
to_date('17-JAN-2005', 'dd-mon-yyyy'));
insert into v values
( 7, to_date('17-JAN-2005', 'dd-mon-yyyy'),
to_date('18-JAN-2005', 'dd-mon-yyyy'));
insert into v values
( 8, to_date('18-JAN-2005', 'dd-mon-yyyy'),
to_date('19-JAN-2005', 'dd-mon-yyyy'));
insert into v values
( 9, to_date('19-JAN-2005', 'dd-mon-yyyy'),
to_date('20-JAN-2005', 'dd-mon-yyyy'));
insert into v values
(10, to_date('21-JAN-2005', 'dd-mon-yyyy'),
to_date('22-JAN-2005', 'dd-mon-yyyy'));
insert into v values
(11, to_date('26-JAN-2005', 'dd-mon-yyyy'),
to_date('27-JAN-2005', 'dd-mon-yyyy'));
insert into v values
(12, to_date('27-JAN-2005', 'dd-mon-yyyy'),
to_date('28-JAN-2005', 'dd-mon-yyyy'));
insert into v values
(13, to_date('28-JAN-2005', 'dd-mon-yyyy'),
to_date('29-JAN-2005', 'dd-mon-yyyy'));
insert into v values
(14, to_date('29-JAN-2005', 'dd-mon-yyyy'),
to_date('30-JAN-2005', 'dd-mon-yyyy'));Hi, John,
Not that you asked, but as you proabably know, analytic functions are much better at doing this kind of thing.
You may be amazed (as I continually am) by how simple and efficient these queries can be.
For example:
WITH got_grp AS
SELECT proj_id, proj_start, proj_end
, proj_end - SUM (proj_end - proj_start) OVER (ORDER BY proj_start) AS grp
FROM v
SELECT ROW_NUMBER () OVER (ORDER BY grp) AS proj_grp
, MIN (proj_start) AS proj_start
, MAX (proj_end) AS proj_end
FROM got_grp
GROUP BY grp
ORDER BY proj_start
;Produces the results you want:
PROJ_GRP PROJ_START PROJ_END
1 01-Jan-2005 05-Jan-2005
2 06-Jan-2005 07-Jan-2005
3 16-Jan-2005 20-Jan-2005
4 21-Jan-2005 22-Jan-2005
5 26-Jan-2005 30-Jan-2005This is problem is an example of Neighbor-Defined Groups . You want to GROUP BY something that has 5 distinct values, to get the 5 rows above, but there's nothing in the table itself that tells you to which group each row belongs. The groups are not defined by any column in hte table, but by relationships between rows. In this case, a row is in the same group as its neighbor (the row immediatly before or after it when sorted by proj_start or proj_end) if proj_end of the earlier row is the same as proj_start of the later row. That is, there is nothing about 03-Jan-2005 that says the row with proj_id=2 is in the first group, or even that it is in the same group with its neighbor, the row with proj_id=3. Only the relation between those rows, the fact that the earlier row has end_date=03-Jan-2005 and the later row has start_date=03-Jan-2003, that says these neighbors belong to the same group.
You're figuring out when a new group starts, and then counting how many groups have already started to see to which group each row belongs. That's a prefectly natural procedural way of approaching the problem. But SQL is not a procedural language, and sometimes another approach is much more efficient. In this case, as in many others, a Constant Difference defines the groups. The difference between proj_end (or proj_start, it doesn't matter in this case) and the total duratiojn of the rows up to that date determines a group. The actual value of that difference means nothing to you or anybody else, so I used ROW_NUMBER in the query above to map those distinct values into consecutive integers 1, 2, 3, ... which are a much simpler way to identify the groups.
Note that the query above only requires one pass through the table, and only requires one sub-query. It does not need a WITH clause; you could easily make got_grp an in-line view.
If you used analytic functions (LEAD or LAG) to compute flag, and then to compute proj_grp (COUNT or SUM), you would need two sub-queries, one for each analytic function, but you would still only need one pass through the table. Also, those sub-queries could be in-line views; yiou would not need to use a WITH clause. -
Passing values for a prepared statement encounters problem
I have a query which runs fine when executed from sqlplus
SELECT SYSDATE + (INTERVAL '10' MINUTE) FROM dual;
The same query when run using a java statement also works well.
when I use a Prepared statement like
String sql = SELECT SYSDATE + (INTERVAL ? MINUTE) FROM dual;
PreparedStatement ps = this.getPreparedStatement(sql.toString());
ps.setString(1, "10");
and execute I get the following exception
ORA-00920: invalid relational operator
I tried another way which also gives me a similar exception
String timeout = "10";
SELECT SYSDATE + (INTERVAL" + timeout + "MINUTE) FROM dual;
Can anybody tell me why the problem happens. Is anything wrong in passing values dynamically for an 'interval' function in oracle?asokan_srini wrote:
Yes friends
Thanks for the reply. It worked out this way as u said
sql.append("SELECT SYSDATE + (INTERVAL ");
sql.append("'" + Integer.parseInt(timeout) + "' MINUTE) FROM dual");
Mr.masijade said.
First of all, there is no reason to do this command, really, but okay.
There may be scenarios like this to use the command
select * from mytable where (systimestamp - lastUpdateTimestamp) > Interval '10' Minute
Is there any other better way to get all records updated before a certain timestamp?Use Timestamp to create a timestamp and PreparedStatement's setTimestamp(), maybe? -
Dynamically obtain parameter count for a prepared statement
Hi JDBC Gurus,
Given a prepared statement, is there a way to figure out the parameter count at runtime? I need this info. to prompt the user for parameter values at the right time from my GUI tool. Any help will be greatly appreciated.i don't know of any way to do this put perusing through the API i am wondering what the getMetaData method of PreparedStatement is supposed to do. it says returns the meta data of a ResultSet's columns but i think it could contain info about the parameters for the PreparedStatement. i guess i just don't see why that method is there... anyone?
-
What is the correct format for localhost URL?
I've installed MAMP to run a local test server.
This appears to be working correctly with the URL in the following format:
http://localhost/folder/filename.php/
Where folder is the folder for the site located inside the Apache Document Root Folder - as defined in the MAMP preferences.
I have web sharing turned off.
Looking around the web it seems that the format for the URL should be:
http://localhost/~username/folder/filename.php
However, when I insert "~username" in the URL the browser can't find the page.
These are my first tentative steps in setting up a local test server and so I'm concerned that something might be amiss!
I've hunted around and can't find any documentation that clarifies the issue.
Can anyone clarify the issue or point me to appropriate documentation.
Thanks.The second format is for a different location - in your Home folder. This would work if; a. Apache was installed using the Home folder; and b. if "folder" existed in the Home folder. Use the form you are currently using since it works.
-
Development of Print Format for Quotation Comparison Statement
Hi,
Can any tell me about what are the transtcion and configuration involeved in developement of
Print format for Quotaiton Comparision.
Regards
AnilNot sure what you mean by printing quotation comparison, however the following will enable you to configure output for RFQ and rejection letters:
IMG > Purchasing > Messages > Output Control > Message Types > Define Message Types for Request For Quotation
First maintain message types for RFQ, there should be 3 already in the standard system, ABSA (Quotation Rejection) MAHN (Reminder) NEU (Inquiry). When you create the RFQ initially, NEU will be determined to output the details of the qutation required. To customise the form:
- select line for NEU
- Double click on processing Routines - This will give you a list of the possible output mediums (print, fax etc...), the print programs and print forms available.
- If you want to customise the form, copy existing (MEDRUCK) to a Z object (ZMEDRUCK) in SE71
- make any required changes to ZMEDRUCK using transaction SE71. If you are simply changing layout then changing the form will be enough, if you require additional data on the form, additional programming will be required in the print program (copy SAPFM06P to ZAPFM06P to make changes with SE80). ABAP programming knowledge very useful here or pass to programmer.
- Update customising previously mentioned to use new form/program
- Maintain Condition records in transaction MN01 if you require the output to arrive on the RFQ automatically
The same process can be used for ABSA and MAHN if required. ABSA will only be triggered from Quotation comparison/maintenance if the rejection indicator is checked. -
Hello All,
Im downloading EAN11 (it is a character of length 18 ) field form MARA table to an excel. In excel i got the value like 3.16514E+12 where as actual value to be displayed is 3165140039925.
But i know that, to get the value displayed without exponential format, i need to put single quatation in front of the number. I mean, we need to concatenate single quatation with the value.
But is there any other way to do this. If im not wrong, we have to do some thing with OLE format.
Good answers will be appriciated.
Thanks in advance.
Best Regards,
Sasidhar Reddy Matli.Please check below code may help to create excel usign OLE.
REPORT ZTEST_BYW.
* OLE specific include file
INCLUDE OLE2INCL.
INCLUDE EXCEL__C.
* data definitions of OLE objects with type ole2_object
PARAMETERS: P_FILENM(80) LOWER CASE OBLIGATORY
DEFAULT 'C:\Documents and Settings\gunasekharb\Desktop\report_tsl.xls'.
DATA: G_TMP_WORKBOOK TYPE OLE2_OBJECT.
DATA: G_TMP_WORKSHEETS TYPE OLE2_OBJECT.
DATA: G_TMP_WORKSHEET1 TYPE OLE2_OBJECT.
DATA: G_TMP_WORKSHEET2 TYPE OLE2_OBJECT.
DATA: G_PC_TEMPLATE LIKE RCGFILETR-FTAPPL
VALUE 'C:\Documents and Settings\gunasekharb\Desktop\mmr_rpt_tsl_tmp.xls'.
DATA: G_EXCEL TYPE OLE2_OBJECT.
DATA: G_WORKBOOKS TYPE OLE2_OBJECT.
DATA: G_WORKBOOK TYPE OLE2_OBJECT.
DATA: G_WORKSHEETS TYPE OLE2_OBJECT.
DATA: G_WORKSHEET TYPE OLE2_OBJECT.
DATA: G_CELL TYPE OLE2_OBJECT.
DATA: G_CELL1 TYPE OLE2_OBJECT.
DATA: G_CELL2 TYPE OLE2_OBJECT.
DATA: G_CELLRANGE TYPE OLE2_OBJECT.
DATA: G_FONT TYPE OLE2_OBJECT.
DATA: G_INTERIOR TYPE OLE2_OBJECT.
DATA: G_BORDERS TYPE OLE2_OBJECT.
DATA: G_FIRST_WS VALUE 'Y'.
DATA: G_ROW TYPE I.
DATA: G_COL TYPE I.
* definition of loop counter
DATA: I TYPE I VALUE '5'.
DATA: BEGIN OF T_SHEET1 OCCURS 1,
COL1(10),
COL2(20),
END OF T_SHEET1.
DATA: BEGIN OF T_SHEET2 OCCURS 1,
COL1(10),
COL2(20),
END OF T_SHEET2.
START-OF-SELECTION.
PERFORM PREPARE_DATA.
PERFORM DOWNLOAD_TO_EXCEL.
END-OF-SELECTION.
* call method of excel 'QUIT'.
* it is now possible to leave the EXCEL application
* remark: you have to go to the EXCEL application and answer the
* popup dialog screen
*& Form PREPARE_DATA
FORM PREPARE_DATA.
T_SHEET1-COL1 = 'A1'.
T_SHEET1-COL2 = 'A2'.
APPEND T_SHEET1.
T_SHEET1-COL1 = 'B1'.
T_SHEET1-COL2 = 'B2'.
APPEND T_SHEET1.
T_SHEET2-COL1 = 'Y1'.
T_SHEET2-COL2 = 'Y2'.
APPEND T_SHEET2.
T_SHEET2-COL1 = 'Z1'.
T_SHEET2-COL2 = 'Z2'.
APPEND T_SHEET2.
ENDFORM. " PREPARE_DATA
*& Form DOWNLOAD_TO_EXCEL
FORM DOWNLOAD_TO_EXCEL.
PERFORM OPEN_EXCEL.
PERFORM ADD_WORKSHEET1.
PERFORM ADD_WORKSHEET2.
PERFORM OPEN_TEMPLATE_FILE.
PERFORM CLOSE_EXCEL.
WRITE: / 'End of program'.
ENDFORM. " DOWNLOAD_TO_EXCEL
*& Form FILL_CELL
*& FORM routine, which fills the specified cell in the EXCEL sheet
*& with the given value
FORM FILL_CELL USING I_ROW TYPE I
I_COL TYPE I
I_VALUE
I_FONTBOLD
I_DIGIT
I_WRAPTEXT
I_HORIZON_ALIGN
I_VERTICAL_ALIGN.
DATA: L_STR TYPE STRING.
CALL METHOD OF G_EXCEL 'CELLS' = G_CELL
EXPORTING #1 = I_ROW
#2 = I_COL.
SET PROPERTY OF G_CELL 'VALUE' = I_VALUE.
IF I_FONTBOLD = 'X'.
GET PROPERTY OF G_CELL 'Font' = G_FONT.
SET PROPERTY OF G_FONT 'Bold' = 1.
ENDIF.
IF NOT I_WRAPTEXT IS INITIAL.
SET PROPERTY OF G_CELL 'WrapText' = 1.
ENDIF.
IF NOT I_HORIZON_ALIGN IS INITIAL.
IF I_HORIZON_ALIGN = 'L'.
SET PROPERTY OF G_CELL 'HorizontalAlignment' = XLLEFT.
ELSEIF I_HORIZON_ALIGN = 'R'.
SET PROPERTY OF G_CELL 'HorizontalAlignment' = XLRIGHT.
ELSEIF I_HORIZON_ALIGN = 'C'.
SET PROPERTY OF G_CELL 'HorizontalAlignment' = XLCENTER.
ENDIF.
ENDIF.
IF NOT I_VERTICAL_ALIGN IS INITIAL.
IF I_VERTICAL_ALIGN = 'T'.
SET PROPERTY OF G_CELL 'VerticalAlignment' = XLTOP.
ELSEIF I_VERTICAL_ALIGN = 'B'.
SET PROPERTY OF G_CELL 'VerticalAlignment' = XLBOTTOM.
ELSEIF I_VERTICAL_ALIGN = 'C'.
SET PROPERTY OF G_CELL 'VerticalAlignment' = XLCENTER.
ENDIF.
ENDIF.
* To set number format for cell
IF I_DIGIT <> ''.
IF I_VALUE IS INITIAL AND I_DIGIT <> '%'.
SET PROPERTY OF G_CELL 'VALUE' = ''.
ELSE.
* Set number format for cell with number
IF I_DIGIT = '1'.
SET PROPERTY OF G_CELL 'NumberFormat' = '#,###.0 '.
ELSEIF I_DIGIT = '2'.
SET PROPERTY OF G_CELL 'NumberFormat' = '#,##0.00 '.
ELSEIF I_DIGIT = '%'.
SET PROPERTY OF G_CELL 'NumberFormat' = '#,##0.00% '.
ELSE.
SET PROPERTY OF G_CELL 'NumberFormat' = '#,### '.
ENDIF.
ENDIF.
ENDIF.
ADD 1 TO I_COL.
ENDFORM.
*& Form OPEN_EXCEL
FORM OPEN_EXCEL.
DATA: L_CNT TYPE I.
* create object excel of OLE class 'EXCEL.APPLICATION'
CREATE OBJECT G_EXCEL 'EXCEL.APPLICATION'.
CALL METHOD OF G_EXCEL 'WORKBOOKS' = G_WORKBOOKS.
CALL METHOD OF G_WORKBOOKS 'ADD' = G_WORKBOOK.
GET PROPERTY OF G_WORKBOOK 'Worksheets' = G_WORKSHEETS.
GET PROPERTY OF G_EXCEL 'ACTIVESHEET' = G_WORKSHEET.
SET PROPERTY OF G_EXCEL 'DISPLAYALERTS' = 0.
GET PROPERTY OF G_WORKSHEETS 'Count' = l_cnt.
L_CNT = L_CNT - 1.
* Delete unwanted worksheets
DO L_CNT TIMES.
GET PROPERTY OF G_EXCEL 'ACTIVESHEET' = G_WORKSHEET.
CALL METHOD OF G_WORKSHEET 'DELETE'.
ENDDO.
ENDFORM. " OPEN_EXCEL
*& Form CLOSE_EXCEL
FORM CLOSE_EXCEL.
SET PROPERTY OF G_EXCEL 'VISIBLE' = 1.
CALL METHOD OF G_WORKBOOK 'SAVEAS'
EXPORTING #1 = P_FILENM.
* quit Excel and free all OLE objects
* call method of g_excel 'QUIT'.
FREE OBJECT G_INTERIOR.
FREE OBJECT G_BORDERS.
FREE OBJECT G_FONT.
FREE OBJECT G_CELL.
FREE OBJECT G_CELL1.
FREE OBJECT G_CELL2.
FREE OBJECT G_CELLRANGE.
FREE OBJECT G_EXCEL.
FREE OBJECT G_WORKBOOKS.
FREE OBJECT G_WORKBOOK.
FREE OBJECT G_WORKSHEETS.
FREE OBJECT G_WORKSHEET.
ENDFORM. " CLOSE_EXCEL
*& Form ADD_WORKSHEET
FORM ADD_WORKSHEET USING I_NAME.
* Add new worksheet
IF G_FIRST_WS <> 'N'.
G_FIRST_WS = 'N'.
GET PROPERTY OF G_EXCEL 'ACTIVESHEET' = G_WORKSHEET.
ELSE.
CALL METHOD OF G_WORKSHEETS 'Add' = G_WORKSHEET.
ENDIF.
SET PROPERTY OF G_WORKSHEET 'NAME' = I_NAME.
G_ROW = 1.
G_COL = 1.
ENDFORM. " ADD_WORKSHEET
*& Form ADD_WORKSHEET1
FORM ADD_WORKSHEET1.
PERFORM ADD_WORKSHEET USING 'Test 1'.
* fill line in EXCEL sheet with headerlines of table columns
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL 'My First Worksheet' 'X' ''
PERFORM MERGE_CELL USING G_ROW 1 G_ROW 4.
PERFORM SET_BORDER USING G_ROW 1 G_ROW 4 4 ''.
ADD 1 TO G_ROW.
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL 'ID'(001) 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL 'Name'(002) 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL 'Telephon'(003) 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL 'Rabatt'(004) 'X' '' '' '' ''.
* loop at customr table and print values into EXCEL sheet
ADD 1 TO G_ROW.
LOOP AT T_SHEET1.
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL T_SHEET1-COL1 '' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL T_SHEET1-COL2 '' '' '' '' ''.
ADD 1 TO G_ROW.
ENDLOOP.
G_COL = 4.
PERFORM SET_BORDER USING 1 1 G_ROW G_COL '' 4.
ENDFORM. " ADD_WORKSHEET1
*& Form ADD_WORKSHEET2
FORM ADD_WORKSHEET2.
PERFORM ADD_WORKSHEET USING 'Test 2'.
* fill line in EXCEL sheet with headerlines of table columns
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL 'My Second Worksheet' 'X' ''
PERFORM MERGE_CELL USING G_ROW 1 G_ROW 4.
PERFORM SET_BORDER USING G_ROW 1 G_ROW 4 1 'X'.
PERFORM SET_COLOR USING G_ROW 1 G_ROW 4 'LT'.
ADD 1 TO G_ROW.
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL 'ID'(001) 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL 'Name'(002) 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL 'Telephon'(003) 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL 'Rabatt'(004) 'X' '' '' '' ''.
* loop at customr table and print values into EXCEL sheet
ADD 1 TO G_ROW.
LOOP AT T_SHEET2.
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL T_SHEET2-COL1 '' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL T_SHEET2-COL2 '' '' '' '' ''.
ADD 1 TO G_ROW.
ENDLOOP.
G_COL = 4.
PERFORM SET_BORDER USING 1 1 G_ROW G_COL 2 'X'.
ADD 4 TO G_ROW.
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL 'This is a wrap text' 'X' ''
'X' 'C' 'T'.
PERFORM FILL_CELL USING G_ROW G_COL 'Vertical - Bottom' 'X' ''
'' 'L' 'T'.
ADD 4 TO G_ROW.
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL 'Amount 1' 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL '100.04' '' 'X' '' '' ''.
ADD 1 TO G_ROW.
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL 'Amount 2' 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL '200.01' '' 'X' '' '' ''.
ADD 1 TO G_ROW.
G_COL = 1.
PERFORM FILL_CELL USING G_ROW G_COL 'Total' 'X' '' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL '=SUM(B13:B14)' 'X' 'X' '' '' ''.
PERFORM FILL_CELL USING G_ROW G_COL '0.00' 'X' 'X' '' '' ''.
PERFORM COPY_CELL USING G_ROW 2 17 5 25 8.
ENDFORM. " ADD_WORKSHEET2
*& Form MERGE_CELL
FORM MERGE_CELL USING I_ROW1 I_COL1
I_ROW2 I_COL2.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL1
EXPORTING #1 = I_ROW1
#2 = I_COL1.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL2
EXPORTING #1 = I_ROW2
#2 = I_COL2.
CALL METHOD OF G_EXCEL 'Range' = G_CELLRANGE
EXPORTING #1 = G_CELL1
#2 = G_CELL2.
CALL METHOD OF G_CELLRANGE 'Merge'.
ENDFORM. " MERGE_CELL
*& Form SET_BORDER
FORM SET_BORDER USING I_ROW1 I_COL1
I_ROW2 I_COL2
I_THICKNESS
I_ALLBORDERS.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL1
EXPORTING #1 = I_ROW1
#2 = I_COL1.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL2
EXPORTING #1 = I_ROW2
#2 = I_COL2.
CALL METHOD OF G_EXCEL 'Range' = G_CELLRANGE
EXPORTING #1 = G_CELL1
#2 = G_CELL2.
IF I_ALLBORDERS IS INITIAL.
CALL METHOD OF G_CELLRANGE 'BorderAround'
EXPORTING #1 = 1 "Continuous line
#2 = I_THICKNESS. "Thickness: 1 - Normal, 4 - Thick
ELSE.
GET PROPERTY OF G_CELLRANGE 'Borders' = G_BORDERS.
SET PROPERTY OF G_BORDERS 'LineStyle' = '1'.
SET PROPERTY OF G_BORDERS 'Weight' = I_THICKNESS.
ENDIF.
ENDFORM. " SET_BORDER
*& Form SET_COLOR
FORM SET_COLOR USING I_ROW1 I_COL1
I_ROW2 I_COL2
I_COLOR.
DATA: L_COLORINDEX TYPE I.
CASE I_COLOR.
when 'BK'.
L_COLORINDEX = 1. "Black
when 'BR'.
l_colorindex = 53. "Brown
when 'OG'.
l_colorindex = 52. "Olive Green
when 'DG'.
l_colorindex = 51. "Dark Green
when 'DT'.
l_colorindex = 49. "Dark Teal
when 'DB'.
L_COLORINDEX = 11. "Dark Blue
WHEN 'ID'.
L_COLORINDEX = 55. "Indigo
when 'G4'.
l_colorindex = 56. "Gray 80%
when 'DR'.
L_COLORINDEX = 9. "Dark Red
when 'OR'.
l_colorindex = 46. "Orange
when 'DY'.
l_colorindex = 12. "Dark Yellow
when 'GR'.
l_colorindex = 10. "Green
when 'TL'.
L_COLORINDEX = 14. "Teal
WHEN 'BL'.
L_COLORINDEX = 5. "Blue
WHEN 'BY'.
L_COLORINDEX = 47. "Blue Gray
when 'G3'.
l_colorindex = 16. "Gray 50%
when 'RD'.
L_COLORINDEX = 3. "Red
when 'LO'.
l_colorindex = 45. "Light Orange
when 'LI'.
l_colorindex = 43. "Lime
when 'SG'.
l_colorindex = 50. "Sea Green
when 'AQ'.
L_COLORINDEX = 42. "Aqua
WHEN 'LB'.
L_COLORINDEX = 41. "Light Blue
WHEN 'VL'.
L_COLORINDEX = 13. "Violet
when 'G2'.
l_colorindex = 48. "Gray 40%
when 'PK'.
L_COLORINDEX = 7. "Pink
when 'GD'.
l_colorindex = 44. "Gold
when 'YL'.
L_COLORINDEX = 6. "Yellow
when 'BG'.
L_COLORINDEX = 4. "Bright Green
WHEN 'TQ'.
L_COLORINDEX = 8. "Turquoise
WHEN 'SB'.
L_COLORINDEX = 33. "Sky Blue
WHEN 'PL'.
L_COLORINDEX = 54. "Plum
when 'G1'.
l_colorindex = 15. "Gray 25%
when 'RS'.
l_colorindex = 38. "Rose
when 'TN'.
l_colorindex = 40. "Tan
when 'LY'.
l_colorindex = 36. "Light Yellow
when 'LG'.
l_colorindex = 35. "Light Green
when 'LT'.
L_COLORINDEX = 34. "Light Turquoise
WHEN 'PB'.
L_COLORINDEX = 37. "Pale Blue
WHEN 'LV'.
L_COLORINDEX = 39. "Lavender
when 'WH'.
L_COLORINDEX = 2. "White
WHEN OTHERS.
L_COLORINDEX = 2. "White
ENDCASE.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL1
EXPORTING #1 = I_ROW1
#2 = I_COL1.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL2
EXPORTING #1 = I_ROW2
#2 = I_COL2.
CALL METHOD OF G_EXCEL 'Range' = G_CELLRANGE
EXPORTING #1 = G_CELL1
#2 = G_CELL2.
GET PROPERTY OF G_CELLRANGE 'Interior' = G_INTERIOR.
SET PROPERTY OF G_INTERIOR 'ColorIndex' = L_COLORINDEX.
ENDFORM. " SET_COLOR
*& Form COPY_CELL
FORM COPY_CELL USING I_CROW I_CCOL
I_PROW1 I_PCOL1
I_PROW2 I_PCOL2.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL
EXPORTING #1 = I_CROW
#2 = I_CCOL.
CALL METHOD OF G_CELL 'Copy'.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL1
EXPORTING #1 = I_PROW1
#2 = I_PCOL1.
CALL METHOD OF G_EXCEL 'Cells' = G_CELL2
EXPORTING #1 = I_PROW2
#2 = I_PCOL2.
CALL METHOD OF G_EXCEL 'Range' = G_CELLRANGE
EXPORTING #1 = G_CELL1
#2 = G_CELL2.
CALL METHOD OF G_WORKSHEET 'Paste'
EXPORTING #1 = G_CELLRANGE.
ENDFORM. " COPY_CELL
*& Form OPEN_TEMPLATE_FILE
FORM OPEN_TEMPLATE_FILE.
CALL METHOD OF G_WORKBOOKS 'Open' = G_TMP_WORKBOOK
EXPORTING #1 = G_PC_TEMPLATE
#2 = 2
#3 = 0
#4 = 1
#5 = 0
#6 = 0
#7 = 1.
CALL FUNCTION 'FLUSH'
EXCEPTIONS
OTHERS = 0.
GET PROPERTY OF G_TMP_WORKBOOK 'Worksheets' = G_TMP_WORKSHEETS.
GET PROPERTY OF G_TMP_WORKSHEETS 'Item' = G_TMP_WORKSHEET1
EXPORTING #1 = 1.
GET PROPERTY OF G_TMP_WORKSHEETS 'Item' = G_TMP_WORKSHEET2
EXPORTING #1 = 2.
CALL METHOD OF G_TMP_WORKSHEET1 'Copy'
EXPORTING #1 = G_WORKSHEET.
CALL METHOD OF G_TMP_WORKSHEET2 'Copy'
EXPORTING #1 = G_WORKSHEET.
* call method of g_tmp_workbook 'Close'.
CALL FUNCTION 'FLUSH'
EXCEPTIONS
OTHERS = 0.
ENDFORM. " OPEN_TEMPLATE_FILE
Edited by: Gunasekhar B on Apr 16, 2009 3:19 PM
Edited by: Gunasekhar B on Apr 16, 2009 3:19 PM -
Correct format for P_JDBCPDS connection parameters / URL ?
Am using the Sqlserver-merant driver with a simple report but can't get past the error message below. Have read through all the posts here & at metalink and all advise updating classpath's etc to point at the Merant drivers, these have all been set ok but its still not working (actually don't recall seeing any thread where this has been resolved).
I believe the problem may lie in the format of the connection parameters in the URL, again from the posts in the forums I've found many variations so need to check which one is actually correct. Oracle's 'Configuring and Using the JDBC PDS' gives examples of sybase and db2 strings but not sql server... has anyone ever got this to work??
error:
REP-4100: Failed to execute data source.
JDBCPDS-62008:com.oracle.ias.jdbc.sqlserver.SQLServerDriver
---------------------------------------------------------------Hi Leah,
The display URL for a Database Source should point to a separate server that provides web access to the document. It is not meant to point back to the SES instance. As the Admin Guide states:
"This connector requires that there is URL-based access to the records in the result set of the view or query."
In other words, the display URL should be something you can copy/paste into your browser location bar to view the document, with the other server rendering the document information to a user completely independently from SES.
HTH,
Mark -
Using Bank Statement in Excel format for Electronic Bank Statement
Hello Gurus,
I have asked my bank for bank statement in the following formats MT940, SWIFT MT942, Multicash, BAI and BAI2 but they seem not to understand me and have not been able to provide that. I have been able to get the bank statement in Excel format and I will like to know how to develop the two TXT files that are required for bank statement upload. Does anybody have a suggestion of how to do the conversion?
ThanksHi
There are various std SAP programs for file conversion. Goto SE38 -> and do an F4 with program name RFEB* or RFE*.
You should get the list of programs related to EBS.
Also just check whts the file format required for tcode FF67.
One more thing will asking the bank for a specific fiel format, you just giv a reference of the file format which can be downloaded from internet.
Hope this helps you.
Regards
Nikhil -
Hello,
I am in the process of transferring old family film footage to digital files. The company I'm taking these reels to is recommending that I put them on an external hard drive in .mov format. They say that this will allow me to edit with iMovie. Your thoughts?
Also, at the present time when I upload my point and shoot Nikon camera and also when I upload my iPhone and iPad, the movie clips are loaded into iPhoto also along with the photos. Will I have the option to do this with these new files?
Regards,
TomYou would need to consult the documentaion for the device you're using. You should be able to find it on the manufacturer's website.
-
Is this assistance, for a nominal fee, called aggregators? I can't find this info anymore, and wonder if anyone else has heard of this.
thanks,https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wa/displayAggregato rs?ccTypeId=13
Check this out - Fabe -
For Electronic Bank Statement:BAI Format
Hi,
Where can I get BAI Format( For electronic Bank Statement maping text file into BAI Format)
Regards
VenkiYou can download it via the following link:
http://web.archive.org/web/20060825050734/www.bai.org/operations/PDF/Cash_Management_2005.pdf
Regards,
Shannon -
Using "IN" clause in prepared statement
I need to set string for an IN clause in a sql query. But I am not able to get the format in which the string to be set.
TABLENAME.COLUMNAME IN ( ? )
preparedStatement.setString( 'A' , 'B' );
It doesn't works
help me out?I need to set string for an IN clause in a sql query.
But I am not able to get the format in which the
string to be set.
TABLENAME.COLUMNAME IN ( ? )
preparedStatement.setString( 'A' , 'B' );
It doesn't works
help me out?You can't do that; the "?" in the SQL for a prepared statement is not used for arbitrary string replacement. Each "?" has to correspond to a data value that will be bound later.
In other words, you can do:
"SELECT * FROM tablename WHERE keyvalue in (?, ?, ?)";
pstmt.setString(1,"A");
pstmt.setString(2,"A");
pstmt.setString(3,"A");There is no way to have a single "?" replaced by a variable-length list. -
Running explain plan on a prepared statement
I'm using IBatis to run queries against an Oracle database. IBatis runs the queries as prepared statements. I want to run explain plan on the prepared statements.
I already have a shim -- a proxy java.sql.Connection object -- that takes the SQL used to create a prepared statement (e.g., "select a, b, c from table d where c = ?"), returns a proxy java.sql.PreparedStatement, and then on the PreparedStatement's execute(), interpolates the bound parameters into the SQL statement, and runs Explain Plan on that (e.g, preparedStatement.setInt(5) is called, followed by preparedStatement.execute(), which results in my proxy running "explain plan for select a, b, c from table d where c = 5;")
Using Spring configuration, I can transparently insert the shim and get explain plans for all queries run through that Connection.
The problem is this: I'm explaining the plan for the SQL with the bound parameters, not necessarily the SQL run for the prepared statement.
Assume that in the above example, there exists an index on column c in table d, and that 5% of d's rows have the value 1, 15% have the value 2, and 80% have the value 3.
For "select a, b, c from table d where c = 1", Oracle will use the index. But for "select a, b, c from table d where c = 3", Oracle will do a full table scan.
What I want to know is what Oracle will do for "select a, b, c from table d where c = ?" when "?" is an unknown, arbitrary value subsequently bound to 1 or to 3.
As I understand it, the query plan for a prepared statement is done once, when the prepared statement is created. At execute time (as I understand it), the query plan is not reformulated based on the actual bound values (though partition pruning is recalculated).
So how can I find out what query plan is actually be used for prepred statement?
Thanks.I already have a shim -- a proxy java.sql.Connection object -- that takes the SQL used to create a prepared statement I believe explain plan is part of PL/SQL rather than external to it.
As such you can pass it via a prepared statement. It is just a matter of getting the syntax correct. And of course collecting the result.
The syntax is going to be be something like the following. You would use it just like you use the existing sql.
begin
select ... from ... where c = ?;
endThe result might be returned a result sets (plural). If so you would need to code appropriately for that.
Maybe you are looking for
-
My new iPad Air will not let me download any apps from the apple store?
I also tried syncing to my iMac and that didn't help either
-
Third-Party Audiobooks - How-to?
I received an audiobook from a third-party website, and now have it in my iTunes library - mixed in with all of my other media. Is there any way to move the audiobook as a whole into the Audiobooks section of iTunes, and conversely, to have it in the
-
What minimum licensing would we need to run mapviewer under a standalone oc4J? Does standalone oc4j require a seperate license? (We are using Database SE one)? Is it possible to run mapviewer under jboss? If so would it need a license? Thank you Chri
-
HP Pavilion Media Center m8300f Hangs on boot
I have a HP Pavilion Media Center m8300f which came loaded with Vista Home Premium. About 18 month sold. Recently the computer would hang on boot up. I used the system restore and went back to a safe install. This worked ok until Windows added more p
-
This happens quite often. I "x" out the browser when I am at a banking site, etc and when I try to re-open Firefox the message clearly states: "Firefox is already running and you must close it before you can open a browser and/or you must re-start yo