Insert one row with FileInputStream bigger than 30M always OutOfMemoryError
Hi,somebody can help me to solve my problem as follow:
The following file 'insertTest.jsp' run with Tomcat-5.0.18 and MySQL-4.0.17.
If I insert a row with a file bigger then 30M,I always get OutOfMemoryError messages shown as next.
In fact , I have adjusted variables as:
set-variable = max_allowed_packet=100M
set-variable = max_heap_table_size=100M
set-variable = tmp_table_size=100M
set-variable = key_buffer_size=100M
set-variable = innodb_buffer_pool_size=100M
set-variable = max_connections=200
set-variable = bulk_insert_buffer_size=100M
set-variable = sort_buffer_size=100M
set-variable = myisam_sort_buffer_size=100M
'insertTest.jsp' :
<%@ page language="java" contentType="text/html;charset=Big5" errorPage="" %>
<%@ page import="java.sql.*,java.io.*" %>
<%
Connection conn = null;
java.sql.Statement stmt = null;
String tableName="goodtable";
boolean tableNameExist=false;
String createtable = "Create table "+tableName+" (sn INT AUTO_INCREMENT NOT NULL PRIMARY KEY ,fileImage longblob)";
Class.forName("com.mysql.jdbc.Driver");
conn =DriverManager.getConnection("jdbc:mysql://thisIpAddress/thisDatabaseName?user=thisUser&password=thisPsw");
try {
DatabaseMetaData dbmd = conn.getMetaData();
String[] types = {"TABLE"};
ResultSet resultSet = dbmd.getTables(null, null, "%", types);
while (resultSet.next()) {
String tName = resultSet.getString(3);
if(tName.equals(tableName)){
tableNameExist=true;
break;
String tableCatalog = resultSet.getString(1);
String tableSchema = resultSet.getString(2);
catch (SQLException e) {}
out.print("<html><body bgcolor='#669999'>");
if(!tableNameExist){
stmt = conn.createStatement();
stmt.execute(createtable);
out.print("<p> <p><center>CreateTable="+tableName+" Ok!<hr>");
else
out.print("<p> <p><center>' "+tableName+" ' already exist!<hr>");
//The test file(at C:\fileSize30M.zip) is put here.
File file = new File("C:\\fileSize30M.zip");
FileInputStream fis = new FileInputStream(file);
String qry="Insert into "+tableName+"(fileImage) values(?)";
java.sql.PreparedStatement pstmt=conn.prepareStatement(qry);
pstmt.setBinaryStream(1,fis,fis.available());
out.print("'before pstmt.executeUpdate()' is ok<p>");
System.out.println("'before pstmt.executeUpdate()' is ok<p>");
int ok=pstmt.executeUpdate();
if(ok==1){
out.print("'after pstmt.executeUpdate()' is ok");
System.out.println("'after pstmt.executeUpdate()' is ok<p>");
fis.close();
pstmt.close();
conn.close();
out.print("</body></html>");
%>
type: Exception report
description: The server encountered an internal error () that prevented it from fulfilling this request.
exception :
javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.insertTest_jsp._jspService(insertTest_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause :
java.lang.OutOfMemoryError
Increase you heap size on Tomcat startup. I haven't used Tomcat in some years but I think you can just set a JAVA_OPTS environment variable with the text Xmx128M and your problems will go away. I'm thinking this is an issue because I'm assuming you are running Tomcat on a Windows box where the default heap for Java is relatively small like 32M or 64M or something like that.
Cliff
Similar Messages
-
Insert multiple rows with autoincrement id
I need to insert multiple rows to a table which has an autoincrement PK (unique), e.g:
Entity:
public Class Entity{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
Private Long id;
Facade:
@PersistenceContext(unitName = "xx-enterprise-ejbPU")
protected EntityManager em;
public void create(Entity entity) {
em.persist(entity);
Service Class:
public Class Service implements ServiceLocal{
@EJB
private XxxFacadeLocal xxxFacade;
public void saveEntity(Entity entity){
xxxFacade.create(entity)
ManageBean:
public Class ManageBean
@EJB
private ServiceLocal service;
public void doSave(ActionEvent event)
service.saveEntity(entity1); //entity.id is set to null, suppose to be generated by DB auto_increment, i.e. insert 3 rows with 3 different ids
service.saveEntity(entity2);
service.saveEntity(entity3);
The result is: Key duplication error on inserting entity2, but entity1 is inserted into DB with id auto increased correctly.
If I insert only one row each time for test purpose, everything works as expected.
But what I need is to insert multiple rows. How to do it?
Thank you in advance.Like this (although the @Basic annotation is very much unnecessary). So if it isn't happening you must have made a mistake somewhere. Are you sure the ID column actually has auto_increment?
Also if you are using Hibernate as the persistence provider and you put it on the classpath, check the packages of the annotations you are using; Hibernate and JPA share some with the same name unfortunately. -
Condition that takes only one row with the maximum cost of the maximum date
I have to the following query
SELECT distinct b.segment1 ||'.'|| b.segment2 as ITEM,
so.vendor_site_id as SUPPLIER,
'VE' as ORIGIN_COUNTRY_ID,
replace(round(l.mto_costo_neto/l.can_unidades_empaque,2),',','.') as UNIT_COST,
5 as lead_time,
null as pickup_lead_time,
l.can_unidades_empaque as supp_pack_size,
1 as inner_pack_size,
'C' as round_lvl,
50 as ROUND_TO_INNER_PCT,
50 as ROUND_TO_CASE_PCT,
50 as ROUND_TO_LAYER_PCT,
50 as ROUND_TO_PALLET_PCT,
null as MIN_ORDER_QTY,
null as MAX_ORDER_QTY,
'FLAT' as PACKING_METHOD,
'N' as PRIMARY_SUPP_IND,
'Y' as PRIMARY_COUNTRY_IND,
case when b.primary_unit_of_measure like '%KG%' then 'KG'
when b.primary_unit_of_measure like '%Kg%' then 'KG'
when b.primary_unit_of_measure like '%UND%' then 'EA'
when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
when b.primary_unit_of_measure = 'Litro' then 'L'
when b.primary_unit_of_measure = 'Unidad' then 'EA'
else null
end as DEFAULT_UOP,
1 as TI,
1 as HI,
null as SUPP_HIER_TYPE_1,
null as SUPP_HIER_LVL_1,
null as SUPP_HIER_TYPE_2,
null as SUPP_HIER_LVL_2,
null as SUPP_HIER_TYPE_3,
null as SUPP_HIER_LVL_3,
null as CREATE_DATETIME,
null as LAST_UPDATE_DATETIME,
null as LAST_UPDATE_ID,
case when b.primary_unit_of_measure like '%KG%' then 'KG'
when b.primary_unit_of_measure like '%Kg%' then 'KG'
when b.primary_unit_of_measure like '%UND%' then 'EA'
when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
when b.primary_unit_of_measure = 'Litro' then 'L'
when b.primary_unit_of_measure = 'Unidad' then 'EA'
else null
end as COST_UOM,
null as TOLERANCE_TYPE,
null as MAX_TOLERANCE,
null as MIN_TOLERANCE
FROM mrp.mrp_sr_assignments sr , MRP.MRP_SR_RECEIPT_ORG ro , MRP.MRP_SR_SOURCE_ORG so,
inv.mtl_system_items_b b, lcm.cmp_lineas_cotizacion l
WHERE sr.SOURCING_RULE_ID = ro.SOURCING_RULE_ID
and ro.SR_RECEIPT_ID = so.SR_RECEIPT_ID
and sr.inventory_item_id in ((select inventory_item_id from TMP.VIVERES_VEGETALES)
UNION ALL
(select inventory_item_id from TMP.GENERICOS)
UNION ALL
(select inventory_item_id from TMP.HIJOS_GENERICOS))
and sr.inventory_item_id = b.inventory_item_id
and b.organization_id = 136
and sr.inventory_item_id = l.cod_producto_idI need to agregate the following condition
For example, The following query
SELECT l2.fec_ini_vigencia_costo, l2.mto_costo_neto, l2.can_unidades_empaque, l2.cod_producto,
REPLACE(ROUND(l2.mto_costo_neto/l2.can_unidades_empaque,2),',','.') costo_unidad
from cmp_lineas_cotizacion l2
order by cod_producto, fec_ini_vigencia_costo desc, mto_costo_neto descgenerate
FEC_INI_VIGENCIA_COSTO MTO_COSTO_NETO CAN_UNIDADES_EMPAQUE COD_PRODUCTO COSTO_UNIDAD
17/06/2010 382.56 12 1.1000008 31.88 -- THIS ONE
17/06/2010 382.56 12 1.1000008 31.88
17/06/2010 371.0832 12 1.1000008 30.92
17/06/2010 371.0832 12 1.1000008 30.92
18/05/2009 382.56 12 1.1000008 31.88
04/05/2009 245.82 12 1.1000008 20.49
13/04/2009 382.56 12 1.1000008 31.88
23/03/2009 373.2072 12 1.1000008 31.1
23/03/2009 373.2072 12 1.1000008 31.1I need to take only one row with the maximum FEC_INI_VIGENCIA with the maximum COSTO_UNIDAD of the table lcm.cmp_lineas_cotizacion l, which is calculated with the formula ROUND(l2.mto_costo_neto/l2.can_unidades_empaque,2)A better example
I need only one row the maximum COSTO_UNIDAD for the maximum FEC_INI_VIGENCIA for every cod_producto_id in the table lcm.cmp_lineas_cotizacion
I need to take these values
FEC_INI_VIGENCIA_COSTO MTO_COSTO_NETO CAN_UNIDADES_EMPAQUE COD_PRODUCTO_ID COSTO_UNIDAD
17/06/2010 382.56 12 1.1000008 31.88 -- THIS!
17/06/2010 382.56 12 1.1000008 31.88
17/06/2010 371.0832 12 1.1000008 30.92
17/06/2010 371.0832 12 1.1000008 30.92
18/05/2009 382.56 12 1.1000008 31.88
04/05/2009 245.82 12 1.1000008 20.49
13/04/2009 382.56 12 1.1000008 31.88
17/06/2010 382.56 12 1.1000008 31.88
17/06/2010 382.56 12 1.1000008 31.88
17/06/2010 371.0832 12 1.1000008 30.92
17/06/2010 371.0832 12 1.1000008 30.92
18/05/2009 382.56 12 1.1000008 31.88
04/05/2009 245.82 12 1.1000008 20.49
13/04/2009 382.56 12 1.1000008 31.88
27/10/2010 1171.549344 12 1.1000009 97.63 -- THIS!
13/10/2010 1171.549344 12 1.1000009 97.63
06/09/2010 1171.549344 12 1.1000009 97.63
02/08/2010 1048.825056 12 1.1000009 87.4
28/07/2010 754.8 12 1.1000009 62.9
27/07/2010 614.04 12 1.1000009 51.17
21/06/2010 954.84 12 1.1000009 79.57
27/05/2010 614.04 12 1.1000009 51.17
07/07/2009 1143.17 12 1.1000010 95.26
28/03/2009 1143.17 12 1.1000010 95.26
27/10/2008 1744.644672 12 1.1000010 145.39
01/07/2008 1690.12224 12 1.1000010 140.84
07/07/2009 1143.17 12 1.1000010 95.26 --THIS!
28/03/2009 1143.17 12 1.1000010 95.26
27/10/2008 1744.644672 12 1.1000010 145.39
01/07/2008 1690.12224 12 1.1000010 140.84
07/07/2009 1143.17 12 1.1000010 95.26
28/03/2009 1143.17 12 1.1000010 95.26
27/10/2008 1744.644672 12 1.1000010 145.39
01/07/2008 1690.12224 12 1.1000010 140.84 -
How I can insert one row on table, with columns settings: readonly = true
I have a problem. (jdeveloper 11.1.1.2.0)
How I can insert row on table (EditingMode= clickToEdit), with columns settings: ReadOnly = true.
When I make click on button create insert, ADF create one row on the table with output text invisible ( ReadOnly = true.)
I make double click, then output text is visible (ReadOnly = false)
I dont want make double click. I want output text is visible (ReadOnly = false), when I make click on button create insert
ThanksHi,
try changing the edit mode of the table when pressing the button and refresh the button. This of course turns the whole table into editable mode, but this is how it needs to work. Alternatively, you create an input form for the user to edit the new record and show the form in a popup or beneath the table. Then when the user submits the created row data, you refresh the table to shwo the new row
Frank -
BUG? ViewObject contains more than one Row with equal Key objects
JDeveloper 10.1.2.1 build 1913
JClient app
aView
----bView
--------cView
------------dView
BEFORE:
cView's detail row set contains two dViewRowImpl rows, as expected:
row 0: key = 100
row 1: key = 101
ACTION:
An attribute, X, in dView is modified by the user, which results in a call to setX in dViewRowImpl.
In setX we have:
1) setAttributeInternal for X
2) transaction.postChanges
3) a call to a procedure in the database to update dependent fields in the same row
4) clearEntityCache on the primary entity of dView
5) setAttributeInternal on a calculated attribute
AFTER:
cView's detail row set contains three dViewRowImpl rows, two of which have the same primary key:
actual:
row 0: key = 100
row 1: key = 101
row 2: key = 101
expected (no change, and unique primary keys):
row 0: key = 100
row 1: key = 101
Any clues appreciated.If your procedure modifies only the current row, or predetermined rows, you can
// see Row.refresh
transaction.postChanges();
// refresh current row
refresh(REFRESH_WITH_DB_FORGET_CHANGES);
// or iterate over procedure-modified rows and refresh eachas an alternative to clearEntityCache. This alternative has the major benefit of not resetting currency in all ViewObjects touched by the cleared Entity. Luckily, this alternative has avoided the problem for us. If your code cannot predict which rows will be updated by your procedure, then you're still in trouble since JBO is apparently more than willing to insert duplicate Row objects into a ViewObject's RowSet after a clearEntityCache. -
Keeping only one row with information from several rows?
Hi,
I have a table with companies. The companies appearing more then once in the table, with different information in different columns. How do I keep one row from each company with all information..?
Example:
Company State City Country
CompA WA Seattle null
CompA null null USA
CompB null null USA
CompB TX null null
...and so on.
And I want out of this:
CompA WA Seattle USA
CompB TX null USA
Any tips?declare @temp table
company char(6),
state char(10),
city char(20),
country char(10))
insert into @temp values ('CompA','WA','Seattle',null),('CompA',null,null,'USA')
,('CompB','Tx',null,null),('CompB',null,null,'USA')
select max(company),MAX(state),MAX(city),MAX(country) from @temp
group by company
--Prashanth -
Table maint genertr inserting multiple rows with all fields editable
Hi
I have created a ztable in se11 and maintained table maintenance generator SM30.
Now i need to insert multiple rows into the table with all fields editable.
How can i achieve this?
Thanks in advance.>
deepak thimmegowda wrote:
> Hi
>
> I have created a ztable in se11 and maintained table maintenance generator SM30.
>
> Now i need to insert multiple rows into the table with all fields editable.
>
> How can i achieve this?
>
> Thanks in advance.
Create a Table maintenance generator with One Step .
regards,
Jinson. -
How to return one ROW with Multiple value seperated by Colon in a SQL Query
Hi,
I have a SQL query as mentioned.
select deptno
from deptI want to mofidfy this query, so that this should return me department list with colon delimeted in one ROW.
10:20:30:40.......Thanks,
DeepakIn 10g:
select rtrim(xmlagg(xmlparse(content deptno || ':')).getstringval(), ':') data
from dept;
DATA
10:20:30:40with apologies for the abuse of XML... -
List out on the one row with all variables from db
from DB
namn
namnID namn
166 -----------------------
167 pierre lemon
170 Lena Jakobsson
171 adas
172 Lena M Jakobsson
175 Per Olofsson
Inmata
id namnID startdate slutdate vc fargkod
50 167 2006-04-20 2006-04-27 Uddevalla Re
54 167 2006-05-20 2006-07-20 Vänersborg A
58 167 2006-08-21 2006-09-01 Uddevalla O
61 170 2006-04-24 2006-05-03 ----- P
<cfquery name="row_stsl" datasource="at">
SELECT DISTINCT count(namnID) as sum_namnID
FROM inmata
group by namnID
</cfquery>
<cfset sum_namnIDa = row_stsl.sum_namnID>
<cfoutput query="row_stsl">
<table border="1">
<tr><td>#sum_namnID#</td></tr>
</cfoutput>
<cfscript>
for (i=1; i lt sum_namnIDa; i=i+1)
writeoutput ( "<td>" & startdate & slutdate
& "</td>");
</cfscript>
<cfoutput>
</table>
</cfoutput>
My idea is to count number of nameID and build one row using
<td> within startdate and slutdate </td>
if there is 3 namnID so create three startdate and slutdate
but don't know exact how to code.
Any suggestion?
I tried to get out startdate and slutdate in ordinal on the
one row.
Name:
eg.
Pierre Lemon 1. 2006-04-24 2006-06-02 2. 2006-06-03
2006-07-25 3. etc startdate and slutdate on the row.<cfquery name="row_stsl" datasource="at">
SELECT Count(inmata.namnID) AS sum_namnID,
First(inmata.startdate) AS Förstaförstartdate,
Last(inmata.slutdate) AS Sistaförslutdate
FROM inmata
WHERE ((inmata.startdate) AND (inmata.slutdate))
GROUP BY inmata.namnID;
</cfquery>
<cfloop query="row_stsl">
<table border="1">
<tr>
<cfscript>
for (i=1; i lte sum_namnID; i=i+1)
writeoutput ("<td>" & #dateformat
(Förstaförstartdate,"yyyy-mm-dd")# & " "
& #dateformat (Sistaförslutdate,"yyyy-mm-dd")# &
"</td>");
</cfscript>
</tr>
</table>
</cfloop>
Resultat:
2006-04-20 2006-09-01 2006-04-20 2006-09-01 2006-04-20
2006-09-01
2006-04-24 2006-05-03
In DB
id namnID startdate slutdate
50 167 2006-04-20 2006-04-27
54 167 2006-05-20 2006-07-20
58 167 2006-08-21 2006-09-01
61 170 2006-04-24 2006-05-03
yes, startdate and slutdate is date as datatype
Is it SQL statement or cfscript I will change on?
Have tried with other sql question but it will not take
effect to get out answer.
SELECT inmata.namnID, Count(inmata.namnID) AS Antal,
inmata.startdate AS start_datum, inmata.slutdate AS slut_datum
FROM inmata
GROUP BY inmata.namnID, inmata.startdate, inmata.slutdate
HAVING (((inmata.startdate) Is Not Null) AND
((inmata.slutdate) Is Not Null));
Because the result is :
2006-04-20 2006-05-03
2006-04-20 2006-04-27
2006-05-20 2006-07-20
2006-08-21 2006-09-01
2006-04-24 2006-05-03
2006-04-20 2006-04-27
2006-08-21 2007-05-03
Any idea?! -
Dear all,
I have a input that looks like this:
HeaderKeySomeHeaderInformationItemKeySomeItemInformationItemKeySomeItemInformation...
Here's the actual input
TEHGMESS0026000000288S0001TEI2____026200006112410400000000 18010000000000 00126000000000126000120600000000002000000000 000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000JTEI2____026200006112410400000000 19010000000000 00126000000000126000120600000000002000000000 000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
HeaderKey = TEHGMESS
ItemKey = TEI2____
Is it possible to process this via MessageTransformBean (my actual scenario is JMS to IDoc)? I already tried but I only succeeded when having new lines in my input to separate between Header and (multiple) Items.
So when the input and my configuration looks like below it works, but when I only have a single row input it doesn't work, even when specifying xml.recordHeader.endSeparator = '0' / xml.recordItem.endSeparator = '0'. I even tried xml.endSeparator = '0' but no luck.
Input that works
TEHGMESS0026000000288S0001
TEI2____026200006112410400000000 18010000000000 00126000000000126000120600000000002000000000 000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
TEI2____026200006112410400000000 19010000000000 00126000000000126000120600000000002000000000 000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
Matching configuration that works for input which structures are delimited by new line.
Paramentername
Parametervalue
Transform.Class
com.sap.aii.messaging.adapter.Conversion
Transform.ContentType
text/xml;charset=utf-8
xml.conversionType
StructPlain2XML
xml.documentName
MT_TEI2Split
xml.documentNamespace
http://hansgrohe.com/pi/MQ/TEI2/10
xml.keyFieldName
SATZARTKey
xml.keyFieldType
CaseSensitiveString
xml.processFieldNames
fromConfiguration
xml.recordHeader.fieldFixedLengths
8,4,9,1,4
xml.recordHeader.fieldNames
SATZARTKey,SATZLENHG,NUTZLEN,MESSAE,MESSNR
xml.recordHeader.keyFieldValue
TEHGMESS
xml.recordItem.fieldFixedLengths
8,4,2,10,8,19,3,3,2,10,6,2,10,6,2,10,6,6,6,6,6,11,9,2,10,6,2,10,6,3,4,3,7,14,8,1,31
xml.recordItem.fieldNames
SATZARTKey,SATZLEN,BUCHART,TRNR,ANDGNR,MITEM,TEIVARI,BSTSTATU,REFTYP,ORNO,POS,REFTYP1,ORNO1,POS1,CHATYP,CHARGE,CHAPOS,ABBVONL,ABBNACH,ZUBVONL,ZUBNACH,I2MENG,I2BUNR,REFTYPN,ORNON,POSN,REFTYP1N,ORNO1N,POS1N,BSTSTATN,ABUSERAB,ABUSERFN,ABUSERNA,I2TIME,I2LIDNR,I2FMCODE,FILLER
xml.recordItem.keyFieldValue
TEI2____
xml.recordsetName
records
xml.recordsetStructure
recordHeader,1,recordItem,*
Any clues on this? Is it even possible to have multiple structures in one row? Many thanks in advance
JensSAP came back to me with this answer:
First, I would like to point the documentation for Message Transform
Bean (MTB) in 7.4:
http://help.sap.com/saphelp_nw74/helpdata/en/57/0b2c4142aef623e10000000a155106/content.htm?frameset=/en/57/0b2c4142aef623e10000000a155106/frameset.htm¤t_toc=/en/45/0ea2de423c2d6be10000000a11466f/plain.htm&node_id=18
As it is written at the beginning of this document, MTB is used to
call classes written for the Plain Adapter Engine. So you may find
additional documentation about the parameters for convertion in the
documentation of the Plain Adapter Engine
(http://help.sap.com/saphelp_nw74/helpdata/en/0d/00453c91f37151e10000000a11402f/content.htm?frameset=/en/1b/d5ef3b1ad56d4fe10000000a114084/frameset.htm¤t_toc=/en/75/246b3de666930fe10000000a114084/plain.htm&node_id=11).There it is written that the structures by default are
arranged line-by-line. The endSeparator just adds additional character
string as a separator after the last column in a row.
I hope that this answers your question. MTB expects the data to be
structured line by line.
You may add a custom module, which transforms the message in the
expected format.
If you have a look at the second link there's even a more precise wording that multiple structures within one line are not supported:
xml.NameA.endSeparator
Even if no specification is made here, a line break must follow since substructures are always expected as a line of the document.
Bottom line is that it's not supported by now and verfied by me with PI 7.4 SP5
Many thanks to Ambrish, Amit and Hareesh for the valuable input. Will probably try to work things out for now following Ambrish's / Hareesh's suggestion as this seems easier to implement. Amit's proposal with a dedicated module however would probably be the more polished solution.
Cheers
Jens -
Inserting multiple rows with single insert statement ?
Hi ,,
Consider a PL/SQL procedure.
I want to pass an array of values and insert in a table with a single statement.
Moreover I want to call this procedure to insert multiple rows from OCI program.
Can some body help ? :(
Thanks
ChanduHi Vincent,
Regular array insert which you have mentioned works in case of insert statement(This is to eliminate multiple calls to server)
Will it work for passing array to Stored procedure, in this case procedure will be called only once with an array.
It will be of great help if you give an example.
Thanks
Chandra -
One row with checkboxes in ALV
Hi All,
I woud like to create an ALV which consists of a row with checkboxes.
Eg.:
Doc - Mat - Unit - Date
1 -1234 - pc - 010109
2 - 545 - pc - 050208
3 - X - X - X
4 - 466 - pc - 251208
You can see that the 3. row has 3 checkboxes.
Is this possible?
Thanks in advance,
Gabor
Edited by: Gabor Peter Kocsis on Jan 15, 2009 9:14 PMHi,
No, you can't take a single row with checkboxes and other rows for other fields.
But instead you can add a checkbox for each row in ALV.
Regards,
Tarun Gambhir -
Insert multiple rows with one sql statement in access
Hi,
I'm trying to copy a table into another. What I want to do is to use "Insert into table1 select * from table2 where field > val". Something like that. I know a lot of databases support it. I was wondering if ms access ODBC driver also supports it. I searched quite a bit and haven't found a definitive answer on this.
Thank youYes, M$ Access 2000 supports it. This is from their help:
INSERT INTO Statement
Adds a record or multiple records to a table. This is referred to as an append query.
Syntax
Multiple-record append query:
INSERT INTO target [(field1[, field2[, ...]])] [IN externaldatabase]
SELECT [source.]field1[, field2[, ...]
FROM tableexpression
Single-record append query:
INSERT INTO target [(field1[, field2[, ...]])]
VALUES (value1[, value2[, ...])
The way you've written the INSERT, table1 and table2 have to have the same # of columns and the same types, of course. -
Insert Duplicate rows with difrent languages
Hello everybody,
I need your help in solving this query with the most performant way.
I have a table:
Create Table "POSITION" (
id number,
TEXT varchar2(50),
Language Varchar2(1)
);insert statments
INSERT INTO POSITION
VALUES (1, 'Secretary', 'E');
INSERT INTO POSITION
VALUES (1, 'Secrétaire', 'F');
INSERT INTO POSITION
VALUES (1, 'Segretario', 'I');
INSERT INTO POSITION
VALUES (1, 'Secretario', 'S');
INSERT INTO POSITION
VALUES (2, 'Assistance', 'E');
INSERT INTO POSITION
VALUES (2, 'Ayuda', 'S');As you have seen the text changes in diffrent languages for the same id. for whatever reasons the data is in complete in all languages (some ids missing english some french and some italian). I need a query to insert the missing language(s) in my example above Id number 2 the language French and Italian is missing so the query should copy the record English instead but with Language = 'F' and one more time with language = 'I' and so on.
in addition the query should look first to copy English if it doesn't exist then French if not then Italian when more than language exists.
hope I make it clear. as i said this query should be performant also as the data size is big.
Thanks for your helpHi,
Okay, I see my mistake now.
You can use MERGE like this:
MERGE INTO position dst
USING (
SELECT p.id
, FIRST_VALUE (p.text IGNORE NULLS)
OVER ( PARTITION BY p.id
ORDER BY l.ord_num
ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING
) AS top_text
, FIRST_VALUE (p.lsource_anguage IGNORE NULLS)
OVER ( PARTITION BY p.id
ORDER BY l.ord_num
ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING
) AS source_language
, l.language
FROM all_languages l
LEFT OUTER JOIN position p PARTITION BY (p.id)
ON l.language = p.language
) src
ON ( src.id = dst.id
AND src.language = dst.language
WHEN NOT MATCHED THEN
INSERT (dst.id, dst.text, dst.language, dst.source_language)
VALUES (src.id, src.top_text, src.language, src.source_language)
;Or you can use INSERT, like this:
INSERT INTO position (id, text, language, source_language)
WITH got_analytics AS
SELECT p.id
, p.text AS orig_text
, FIRST_VALUE (p.text IGNORE NULLS)
OVER ( PARTITION BY p.id
ORDER BY l.ord_num
ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING
) AS top_text
, l.language
, FIRST_VALUE (p.source_language IGNORE NULLS)
OVER ( PARTITION BY p.id
ORDER BY l.ord_num
ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING
) AS source_language
FROM all_languageS l
LEFT OUTER JOIN position p PARTITION BY (p.id)
ON l.language = p.language
SELECT id, top_text, language, source_language
FROM got_analytics
WHERE orig_text IS NULL
;This is basically what I posted before, except that I added
... ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWINGto all the analytic clauses.
The problem was that when you say "ORDER BY ord_num", that creates a default window that includes only the current ord_num and lower values. We need to look at all values, lower and higher, so we have to override the default windowing.
Edited by: Frank Kulash on Feb 29, 2012 8:58 PM
Edited by: Frank Kulash on Mar 1, 2012 11:31 AM
Added correct MERGE statement. -
Splitting multiple rows onto one row with different fields
Hi all,
I have a table. One Course_Code have multiple section_codes i.e. ("NUM" column does not relate to sectype its just an order!)
Code--------num----Sec_code---Sectype---DESC----------------WEIGHT
1603--------1-------7427-----------C------------Coursework-------- 50
1603--------2-------7428-----------E------------ Exam---------------- 50
When I query this table i want to be able to see the coursework, exam split on the same row. i.e.
Code-----Coursework---------Exam
1603-----C=50------------------E=50
any help would be greatHi,
"Splitting" means taking an item (such s a string like 'C=50') and diviiding it into smal;ler items (such as the sub-strings 'C' and '50'). Are you really trying to split something, or are you trying to do just the opposite (e.g., combine smaller strings into a bigger string)?
I think what you're looking for is a Pivot . Like so many other things, exactly how to do it depends on your version of Oracle and your requirements.
Here's one way:
SELECT code
, MIN (CASE WHEN descr = 'Coursework' THEN sectype END)
|| '='
MIN (CASE WHEN descr = 'Coursework' THEN weight END) AS coursework
, MIN (CASE WHEN descr = 'Exam' THEN sectype END)
|| '='
MIN (CASE WHEN descr = 'Exam' THEN weight END) AS exam
FROM table_x
GROUP BY code
;This will work in Oracle 8.1 and higher. Starting in Oracle 11.1, you could also use the SELECT ... PIVOT feature.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.
Maybe you are looking for
-
Hi Gurus! I want to hard code a field in a form. so that I cannot enter every time that field. Can you please tell me how to do using forms personalizations. Thanks, Darren
-
What is d BAPI for reversal of Good Receipt Note(GRN) for movement type 102
Hi ABAPers, I have got requirement like this , I have done Goods Receipt Note (GRN) based on Purchse order Number using '.BAPI_GOODSMVT_CREATE' with 101 movement type. But now my requirement is reversal of good receipt note(GRN) based on Materi
-
Q180: Slow download speeds even slower then upload speed?
Just looking for answers. I have recently brought a Q180, using it wifi upstairs. And I just upgraded to a DOCSIS 3.0 modem gateway (Moto SBG 6580) I have Charter as my IP I pay for data plus 30 Mbps download. My son's laptop, my HP laptop and my Mac
-
What is the best way to audit data
What is the best way to audit actual changes in the data, that is, to be able to see each insert, update, delete on a given row, when it happened, who did it, and what the row looked like before and after the change? Currently, we have implemented ou
-
We are preparing update of app for Google Play and during testing of new version (just downloaded as APK from ftp to device) we've encountered this error. In short it means, that we can't buy new issues, nor download previously bought one. I'm not ab