UTF-8 insert problem ?
we maintain an old project,
we get insert form values into mysql , run on glassfish
String chineseName = req.getParameter("chinese_Name") == null ? "" : req.getParameter("chinese_Name").trim(); out.print(chineseName); // work fine get Chinese character
if I hard code the Chinese character , it also work fine
ps.setString(4, "日本");
but if we have ps.setString(4, chineseName); we get strong symbol in db , what is wrong !
Thank you
OK,
insertCount = StudentInsert(university_ID, surName, english_Name, chineseName, ..)
out.println("Hello1"+chineseName ); this one get chinese character
System.out.print("Hello2"+chineseName); this one turn to Hello2網球初班what is wrong!!
Similar Messages
-
Update/Insert Problem with Oracle Warehouse Builder
Hello,
i have update/insert problem with owb.
Situation: I have a source-table called s_account and a target table called w_account_d. In the target table are already data which was filled trough the source table inserts. Now anyone make changes on data on the target table. This changes should now give further on the source table with an update operation. But exactly here is the problem i can´t map back the data to source because that will create a loop.
My idea was to set a trigger but i can´t find this component in owb or is anywhere hidden?
Also i have already seen properties as CDC or conditonal loading in the property inspector of the table, but i have no idea how it works.
Give it other possibilities to modeling this case? or can anyone me explain how i can implement this eventually with CDC?
I look forward for your replies :)Hi
thanks for your answer. I follow your suggestion and have set the constraints of both tables into the database directly.Nevertheless it doesn´t work to begin. In the next step i found by right click on a table the listpoint "configure" - I goes to "unique key" --> creation method and set here follow options: Constraint State = ENABLE, Constraint Validation = Validate. That error message that appears before by the deployment disappears yet. Now i start the job to test if the insert/update process works right. Finally it seems to work - but not really.
My Testscenario
1. Load the data from source table about the staging area to data warehouse table: Check - it works!
2. Change one data record in source table
3. Load the source table with changed data record once again to staging area: Check - it works!
4. Load new staging area table with the changed data record to data warehouse table: Check it works! BUT, BUT i can not recognize if it is insert or update operation, then under the design window by jobs execution windows is reported "rows selected 98", Rows inserted" is empty and "rows updated" is empty. So i think works not correct, then my opinion if it works correct it should show be "rows updated" 1.
What can yet now still be wrong or forgotten? Any ideas?
*By the way think not 98 rows there is not important if you make an update or insert which performance. It is an example table the right tables have million of records.*
I look forward for your answers :) -
Hello all,
I was wondering about DB operations in JSF pages, so I took a look over the Single Page CRUD example. What hitted me was there is a need for a two step insertion, first by issuing a select in search for the biggest ID of the primary key, and after that the insertion of the element with that obtained biggest ID + 1. I see at least 2 problems with this approach:
1. Concurrency issues.What happends if 2 users are issuing at the same time an insert operation over the same table? There is the possiblity of getting the same ID to insert, and the first one could insert, but the second one would fail even if it's request is logically corect (validated & converted). I see three solutions over the insert problem:
a. lock on the database (if it's possible).
b. using a synchronized block in the application bean to get the ID and insert.
c. using DB specific constructs (e.g. MySQL's AUTO_INCREMENT)
2. Overhead issues. Why doing in two steps an operation that should be just an insert? Previous a. an b. approaches do not solve our overhead problem, because we still have two steps in insertion; we only synchronize them.
I was wondering which is the best practice for production quality web applications. Personally because I've picked MySQL as DB I've used AUTO_INCREMENT, but the immediate huge and obvious drawback is dumping DataProvider's capability of changing the storage medium at a glance.I'm not sure if I entirely understood your questions here.
- Concurrency problem.
database bound Data provider underneath uses CachedRowset, which uses SyncProvider to take care of concurrency problem. If the default RIOptimisticProvider is not enough, it possible to register other more sophisticated SyncProvider.
You can read about it here.
http://java.sun.com/j2se/1.5.0/docs/api/javax/sql/rowset/CachedRowSet.html
- Overhead issue
I believe, it is possible to let the DB auto increment the primary key field, and left it out in the insertion from data provider.
- Winston
http://blogs.sun.com/roller/page/winston?catname=Creator -
I just upgraded to CS3. When I insert my swf file dreamweaver
is only placing this in the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"
width="670" height="308" title="bob">
<param name="movie" value="/homeMovie4.swf" />
<param name="quality" value="high" />
<embed src="/homeMovie4.swf" quality="high" pluginspage="
http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="670"
height="308"></embed>
</object>
</body>
</html>
That's it! Thus when I upload to the server I don't get to
see a flash movie. It worked fine in version 8 but 8 inserted
additional code. PLEASE HELP....is there some option I don't have
turned on?????
Thanks
Andy
TextAre you sure you just aren't looking at all the code? When I
follow your
steps, I get this -
<script type="text/javascript">
AC_FL_RunContent(
'codebase','
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','wid th','132','height','82','src','Flash/rollingsquare','quality','high','pluginspage','http:/ /www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','Fl ash/rollingsquare'
); //end AC code
</script><noscript><object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"
width="132" height="82">
<param name="movie" value="Flash/rollingsquare.swf" />
<param name="quality" value="high" />
<embed src="Flash/rollingsquare.swf" quality="high"
pluginspage="
http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="132"
height="82"></embed>
</object></noscript>
Note that *your* code IS there, but it's properly placed
within <noscript>
tags. Are you certain you do not have that?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"wwwlord" <[email protected]> wrote in
message
news:[email protected]...
> Open DWCS3
> My site is defined
> File - New - blank page HTML
> File save as whatever.htm
> Click in the design window....cursor is in top left
corner of the view
> Insert - Media - Flash (first selection in the list)
> Browse in my site to the swf file
> The accessibility pop up shows up title in this case was
bob
> Flash object appears in the design view and code is
written as it appears
> in
> my first post.
>
> I have 4 installs in my office none of which as this
problem.
> I have a client that installed DWCS3 earlier this week
and is having the
> identical problem.
>
> I have reinstalled and I have also tried to insert the
media using the
> Common
> toolbar....same problem.
>
> Ideas????? I kinda need to be able to insert flash. I
have not found any
> forums or KB's that address this specific problem of not
writing all the
> code
> needed.
>
> Any help is appreciated.
>
> -
UTF-8 encoding problem in HTTP adapter
Hi Guys,
I am facing problem in the UTF-8 multi-byte character conversion.
Problem:
I am posting data from SAP CRM to third party system using XI as middle ware. I am using HTTP adapter to communicate XI to third party system.
in HTTP configuration i have given XML code as UT-8 in the XI payload manipulation block.
I am trying to post Chines characters from SAP CRM to third party system. junk characters are going to third party system. my assumption is it is double encoding.
I have checked the Xml messages in the Message monitoring in XI, i can able to see the chines charaters in XML files. But in the third party system it is showing as junk characters.
Can you please any one help me regarding this issue.
Please let me know if you need more info.
Regards,
SriniSrinivas
Can you please go through the SAP Notes 856597 Question No.3 which may resolve your issue? Also have you checked SAP Notes 761608,639882, 666574, 913116, 779981 which might help you.
---Satish -
Utf-8 encoding problem on solaris
Hello all.
I am using weblogic 9.2 and I am facing a very weird problem regarding the encoding. I fetch data from the db (informix btw) and I forward data as utf-8 to jsps. I have set up everything succesfully on my web.xml, weblogic.xml and all jsps include the page directive for utf-8. When I deploy my application on windows 2k machine everything goes smooth. But when the deployment happens on a solaris machine my jsps show "?" instead of letters. Has anyone faced this problem before? Could you plz direct me towards a solution because this thing has taken me days and days and I still haven't managed to find a solution
Thanx in advance
axelHi,
Start the app, and hook an Eclipse debug project to it. Check if the enconding problem is while retrieving from the DB or while generating the response. If the issue is on the DB, you may need to define the enconding on the connection (I am not sure what driver you are using, but should be able to check this out.) If the issue is while generating the response, just XML escape every character.
Regards,
LG -
User defined field insertion problem in Stock Taking Report (PLD)
We are creating one PLD for one of our customer for Stock Taking Report by modifying the existing sytem report. We will insert two user defined fields (Rack & Bin) from OITW table and link these with the warehouse code field which is at report header as there are different warehouse for the item and material is kept in different rank and bin in different warehouse. But after inserting these fields we found that repetative area becomes blank in the report.
So please let us know how to overcome this problem.
Thanks & with regards.
Aloke
Edited by: ALOKE BANDYOPADHYAY on Sep 4, 2010 4:42 PMHi Aloke,
This PLD is one of the hard coded PLD. You are not able to add UDF freely. I believe you may only add UDF from OITM table. Try you own report instead.
Thanks,
Gordon -
hi guys,
i want to insert the data into sap r/3 table..via jco using bapi
here is the program...., but data is not found in the sap table...
any wrong in my program ?...
they given some data to insert into sap table
import parameters,table rows.... i shown in the below program.(exact information i set )
IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZHR_INFOTYPE_OPERATION");
if(ftemplate != null) {
// Create a function from the template
JCO.Function function = ftemplate.getFunction();
JCO.ParameterList paralist=function.getImportParameterList();
paralist.setValue("11","PERNR");
paralist.setValue("INS","ACTIO");
paralist.setValue("A","TCLAS");
paralist.setValue("20071213","BEGDA");
paralist.setValue("20071213","ENDDA");
paralist.setValue("1","OBJPS");
paralist.setValue("LTA","SUBTY");
client.execute(function); //executing the function.
JCO.Table sales_orders = function.getTableParameterList().getTable("PROPOSED_VALUES");
sales_orders.appendRows(3);
System.out.println("after function"+sales_orders.getNumRows());
for(int i=0;i<sales_orders.getNumRows();i++)
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-AMTEX","FNAME");
sales_orders.setValue("200.00","FVAL");
sales_orders.nextRow();
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-JBGDT","FNAME");
sales_orders.setValue("20071213","FVAL");
sales_orders.nextRow();
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-JENDT","FNAME");
sales_orders.setValue("20071213","FVAL");
JCO.Table sales_orders1 = function.getTableParameterList().getTable("MODIFIED_KEYS");
sales_orders1.setRow(1);
sales_orders1.appendRow();
sales_orders1.setValue("11","PERNR");
sales_orders1.setValue("0582","INFTY");
sales_orders1.setValue("LTA","SUBTY");
sales_orders1.setValue("1","OBJPS");
sales_orders1.setValue("20071213","BEGDA");
sales_orders1.setValue("20071213","ENDDA");
System.out.println("modified"+sales_orders1.getNumRows());
System.out.println("modified"+sales_orders.getNumRows());
OUTPUT: in my console it showing it appended...
but that record is not present in the sap r/3 table
when abapers are checking that record...hi,
this is a custom functiion module which is a rfc
here record is not inserting in the sap r/3 table
what is the problem?
i got the ouput like this......
MODIFIED_KEYS
PROPOSED_VALUES
IMPORT ACTIO
IMPORT BEGDA
IMPORT DIALOG_MODE
IMPORT ENDDA
IMPORT LUW_MODE
IMPORT MASSN
IMPORT NO_ENQUEUE
IMPORT NO_EXISTENCE_CHECK
IMPORT OBJPS
IMPORT PERNR
IMPORT PERSG
IMPORT PERSK
IMPORT PLANS
IMPORT SEQNR
IMPORT SPRPS
IMPORT SUBTY
IMPORT TCLAS
IMPORT WERKS
EXPORT HR_RETURN
EXPORT RETURN
EXPORT RETURN1
NO OF ROWS ARE:---3
THE COLUMNS IN THE TABLE ARE:--4
INFTY: 0582
FNAME: P0582-AMTEX
FVAL: 200.00
SEQNR: 00
INFTY: 0582
FNAME: P0582-JBGDT
FVAL: 20061215
SEQNR: 00
INFTY: 0582
FNAME: P0582-JENDT
FVAL: 20061215
SEQNR: 00
PERNR: 00000011
INFTY: 0582
SUBTY: LTA
OBJPS: 1
SPRPS:
ENDDA: 2006-12-15
BEGDA: 2006-12-15
SEQNR: 000 -
Insert problem using a SELECT from table with a index by function TRUNC
I came across this problem when trying to insert from a select statement, the select returns the correct results however when trying to insert the results into a table, the results differ. I have found a work around by forcing an order by on the select, but surely this is an Oracle bug as how can the select statements value differ from the insert?
Platform: Windows Server 2008 R2
Oracle 11.2.3 Enterprise edition
(I have not tried to replicate this on other versions)
Here are the scripts to create the two tables and source data:
CREATE TABLE source_data
ID NUMBER(2),
COUNT_DATE DATE
CREATE INDEX IN_SOURCE_DATA ON SOURCE_DATA (TRUNC(count_date, 'MM'));
INSERT INTO source_data VALUES (1, TO_DATE('20120101', 'YYYYMMDD'));
INSERT INTO source_data VALUES (1, TO_DATE('20120102', 'YYYYMMDD'));
INSERT INTO source_data VALUES (1, TO_DATE('20120103', 'YYYYMMDD'));
INSERT INTO source_data VALUES (1, TO_DATE('20120201', 'YYYYMMDD'));
INSERT INTO source_data VALUES (1, TO_DATE('20120202', 'YYYYMMDD'));
INSERT INTO source_data VALUES (1, TO_DATE('20120203', 'YYYYMMDD'));
INSERT INTO source_data VALUES (1, TO_DATE('20120301', 'YYYYMMDD'));
INSERT INTO source_data VALUES (1, TO_DATE('20120302', 'YYYYMMDD'));
INSERT INTO source_data VALUES (1, TO_DATE('20120303', 'YYYYMMDD'));
CREATE TABLE result_data
ID NUMBER(2),
COUNT_DATE DATE
);Now run the select statement:
SELECT id, TRUNC(count_date, 'MM')
FROM source_data
GROUP BY id, TRUNC(count_date, 'MM')You should get the following:
1 2012/02/01
1 2012/03/01
1 2012/01/01Now insert into the results table:
INSERT INTO result_data
SELECT id, TRUNC(count_date, 'MM')
FROM source_data
GROUP BY id, TRUNC(count_date, 'MM');Select from that table and you get:
1 2012/03/01
1 2012/03/01
1 2012/03/01The most recent month is repeated for each row.
Truncate your table and insert with the following statement and the results should now be correct:
INSERT INTO result_data
SELECT id, TRUNC(count_date, 'MM')
FROM source_data
GROUP BY id, TRUNC(count_date, 'MM')
ORDER BY 1, 2;If anyone has encountered this behavior before could you please let me know, I can't see that I am making a mistake as the selects results are correct they should not differ from what is being inserted.
Edited by: user11285442 on May 13, 2013 5:16 AM
Edited by: user11285442 on May 13, 2013 6:15 AMHi,
welcome to the forum. I cannot reproduce the same behavior.
Could you please post the SQLPlus output while executing all commands, like it has been done by S10390?
Also post the output of the following command:
SELECT * FROM v$version;When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
Formatted code is easier to read.
Regards.
Al -
Report designer - inserting problem
hi,
we want to use report designer for formatting reports. When we insert
query to report then following error occurs: internal error
ID: E-CREATEFROMQUERY and message: reference to object is not set to
instance of the object. When I go through this errors and execute
this report to web I get this error: Web Item Report error: Tag "band"
with name "footer1": Tag "keyfigure": Nested tag "y" must not
be empty. Have you any solution for this problem?
ThanxHi,
I mean frontend SP 12 (is already released). You can stay on your SPS in ABAP, Java. Frontend is compatible with older backend.
Regards, Karol -
hi
i am inserting in a table values like-----
insert into tab1(col1) values(seq.nextval);
my col1 of tab1 is of varchar2(20) datatype and seq is a sequence.
now an error is coming
PL/SQL: ORA-00984: column not allowed here
why??does not look like any error here...
14:14:07 SQL> CREATE TABLE tab1 (col1 VARCHAR2(20));
Table created.
Elapsed: 00:00:00.00
14:14:20 SQL> CREATE SEQUENCE seq START WITH 1 INCREMENT BY 1;
Sequence created.
Elapsed: 00:00:00.00
14:14:46 SQL> INSERT INTO tab1(col1) VALUES(seq.NEXTVAL);
1 row created.
Elapsed: 00:00:00.00
14:15:06 SQL> SELECT * FROM tab1;
COL1
1
Elapsed: 00:00:00.00
14:15:13 SQL> INSERT INTO tab1(col1) VALUES(seq.NEXTVAL);
1 row created.
Elapsed: 00:00:00.00
14:15:22 SQL> SELECT * FROM tab1;
COL1
1
2
Elapsed: 00:00:00.00can you give more details about your problem, desc of your table, name of the sequence etc... -
Hello,
I was wondering how to solve a problem at inserting new rows in a mysql database. I have a table named employees and one named addresses. In order to link an address to an employee I use an address_id at the employee table. Though, the addresses table is also used by so many other tables. The problem is that every time I insert an employee to the database (and therefore an address) I need to know the address_id so that I can insert it into the proper column in the employee row. The address_id is autonumerical. One solution I thought was to query the addresses table before the insertion to get the next address_id. Then use that number in the employees table. Though, I imagine that when the web applications is used by a large number of people at the same time, there are going to be some concurrency problems.
What can be a better solution?
Is there a better data model I could use for this matter?
I hope I made myself clear in my writing,
Thank you,
Alfredo Fern�ndez A.Typically you do the followng.
1. Start a transaction.
2. Insert address - which also returns the id of the insertion.
3. Insert the employee.
4. Commit the transaction.
Step 2 depends on what specific database you are using.
It can also depends on the business rules for an address. -
Hi! we are having a problem with XML encoding. An external system A sends us a XML message through HTTP. An example of the XML is:
<?xml version="1.0" encoding="UTF-16"?>
<Envelope version="01.00">
</Envelope>
The system A uses UTF-16 for the encoding. We write a Java mapping to manipulate the data and writes out the data in UTF-8 and use UTF-8 in the header. Then we would do a message mapping. The trace shows that the Java mapping gets executed successfully. However, it throws out a ParserException in the message mapping. This is a copy of the trace log:
<Trace level="1" type="T">RuntimeException during appliction Java mapping com/sap/xi/tf/_Can_HRXML_to_RFC_Req_</Trace>
<Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Invalid char #0x0(:main:, row:3, col:0) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:41) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:79) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:232) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:63) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.SequenceMapping.executeStep(SequenceMapping.java:55) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:78) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:88) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:63) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0.processFunction(MappingServiceObjectImpl0.java:131) at sun.reflect.GeneratedMethodAccessor294.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy42.processFunction(Unknown Source) at sun.reflect.GeneratedMethodAccessor568.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:95) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113) at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:171) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)</Trace>
When I run SXMB_MONI to show the processed XML message, the message from the system A isnt shown correctly. This is what it says:
The XML page cannot be displayed
Switch from current encoding to specified encoding not supported. Error processing resource 'file:///C:/Documents and Setti...
<?xml version="1.0" encoding="UTF-16"?>
I tried to use a HTTP post tool to post the XML message, if I changed UTF-16 to UTF-8, the message could be processed successfully.
How do we resolve this encoding problem? The external system A could change the encoding scheme to UTF-8, but the header is hard-coded, and will be remained to be UTF-16 whatever scheme it uses. Any input will be appreciated.
JulieHi,
I have a similar problem.
Input is xml with UTF8 encoding, output is xml with UTF8 encoding.
In spite of that simple situation, Transformer returns bad output:
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(outputStream);
/*Properties properties = transformer.getOutputProperties();
properties.setProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperties(properties);*/ this didn't help
transformer.transform(source, result);
//source --> correct in UTF8
//result --> after transformation is incorrect in UTF8
And the result ist:
An invalid character was found in text content. Error processing resource 'file:///C:/Documents and Settings/rlatta/Local S...
<?xml version="1.0" encoding="utf-8" ?><SDS_XSD_ZPPM_POB><pob>070</pob><skratkaPobocky>SE</...
Does anybody know some answer?
p.s. we recently installed support packages SAP_BASIS 13, SAP_ABA 13. Before it worked so far I know. -
Multiple record insert problem in Oracle Procedure that uses a cursor
Dear X-pert guies,
I have a oracle procedure that use a cursor, I repeatedly make query on 1st table using cursor value and insert that queried value(of 1st table) to 2nd table
y_summary. y_summary has composite primary key :PK_Y_SUM (BILL_DATE, TRUNK_MGR, IDD_FLAG, PK_FLAG, PREFIX).*
when i run the procedure explicit2('201001'); the it gives me the error:::: begin explicit2('201001'); end;_
ORA-00001: unique constraint (PRM.PK_Y_SUM) violated_
ORA-06512: at "PRM.EXPLICIT2", line 413_
ORA-06512: at line 1_
but when i remove the composite primary key from y_summary table then, the procedure runs ok and make so many duplicate entries in y_summary.
but i want the single record to be inserted for single time in y_summary ,so You guies are honorly requested to make the required help .
the structure of y_summary Table and Procdure code is given below.
Table:
-- Create table
create table Y_SUMMARY
BILL_DATE VARCHAR2(10) not null,
TRUNK_MGR VARCHAR2(20) not null,
IDD_FLAG VARCHAR2(10) not null,
PK_FLAG NUMBER(2) not null,
OUTCALLS NUMBER(20,2),
OUTDUR NUMBER(20,2),
PREFIX VARCHAR2(10) not null
tablespace TBS_PRM_D01
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
initial 64K
minextents 1
maxextents unlimited
-- Create/Recreate primary, unique and foreign key constraints
alter table Y_SUMMARY
add constraint PK_Y_SUM primary key (BILL_DATE, TRUNK_MGR, IDD_FLAG, PK_FLAG, PREFIX)
using index
tablespace TBS_PRM_D01
pctfree 10
initrans 2
maxtrans 255
storage
initial 64K
minextents 1
maxextents unlimited
Procedure:
create or replace procedure explicit2( month_val in varchar2) is
cursor explicit_cur is select dest_code from y_table where dest_code like '44%' order by dest_code desc;
dummy varchar2(100);
lv_length Number(9);
sqlstr varchar2(2500);
rec_count1 number;
rec_count2 number;
rec_count3 number;
begin
open explicit_cur;
LOOP
fetch explicit_cur into dummy;
EXIT WHEN explicit_cur%NOTFOUND;
rec_count1 :=0;
rec_count2 :=0;
rec_count3 :=0;
lv_length := length(dummy);
sqlstr := 'select count(*) from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr into rec_count1;
sqlstr := 'select count(*) from y_table_data1 t where t.fee_dur_1_2 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'',
''ITAX1B'',''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr into rec_count2;
sqlstr := 'select count(*) from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'',
''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''012'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr into rec_count3;
if(rec_count1>0) then
sqlstr := 'insert into y_summary(BILL_DATE ,PREFIX, TRUNK_MGR,OUTCALLS , OUTDUR , IDD_FLAG , PK_FLAG )
select '|| month_val||' ,substr(t.orig_called_num,1,'||lv_length||'),t.trunkout_operator ,count(*) , round(sum(ceil(t.duration / 15) * 15) / 60, 0),''00'',''1'' from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||''''|| ' group by t.trunkout_operator,substr(t.orig_called_num,1,'||lv_length||')';
execute immediate sqlstr;
commit;
sqlstr :='DELETE from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr;
commit;
end if ;
if(rec_count2>0) then
sqlstr :='insert into y_summary(BILL_DATE ,PREFIX, TRUNK_MGR,OUTCALLS , OUTDUR , IDD_FLAG , PK_FLAG )
select '|| month_val||' ,substr(t.orig_called_num,1,'||lv_length||'),t.trunkout_operator ,count(*) , round(sum(ceil(t.duration / 15) * 15) / 60, 0),''00'',''0'' from y_table_data1 t where t.fee_dur_1_2 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' group by t.trunkout_operator,substr(t.orig_called_num,1,'||lv_length||')';
execute immediate sqlstr;
commit;
sqlstr :='DELETE from y_table_data1 t where t.fee_dur_1_2 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr;
commit;
end if;
if(rec_count3>0) then
sqlstr :='insert into y_summary(BILL_DATE ,PREFIX, TRUNK_MGR,OUTCALLS , OUTDUR , IDD_FLAG , PK_FLAG )
select '|| month_val||',substr(t.orig_called_num,1,'||lv_length||'),t.trunkout_operator ,count(*) , round(sum(ceil(t.duration / 15) * 15) / 60, 0),''012'',''0'' from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''012'' group by t.trunkout_operator,substr(t.orig_called_num,1,'||lv_length||')';
execute immediate sqlstr;
commit;
sqlstr :='DELETE from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''012'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr;
commit;
end if;
end loop;
close explicit_cur;
end explicit2;
Edited by: user10951541 on 25.4.2010 12.08Dear concern
Really sorry not to make format listing because i am amature to this blog.
my anwser to your way .
1. I have Tested my SQL statements manually in SQL*Plus. this runs ok
2. "Cursor loops, such as the one you have coded here, have been obsolete in Oracle since version 8i 12+ years ago.
Look up BULK COLLECT and FORALL in the docs and use them instead."
I am trying to make use of the BULK COLLECT and FORALL statement in proper location.
3. "Your procedure never performs a commit so no work actually takes place" i need to get the anwser why........................?
4. "On what basis was the decision made to use the default PCTFREE and PCTUSED values of 10 and 40?"
is there any problem if default is used..? if any suggestion........pls
5." You did not format your listing using the CODE tags as explained in the FAQ making your listing unreadable ... so I've not read it.
Please read the FAQ and use the proper way to post code so we can understand it. Then perhaps we can help you further. " really sorry not to make understandable to you..? but i will try from next post..
I really will try to be synced..
My aim is to make query to Table A using the cursor value like( '4422','442','4411','441','44') and get some data in accordance of these values.Then i put the data into another Table B. same time i need to delete the record from Table A containing the prefix value in accordance for example- i compute value for '4422' from Table A and put the computed value to Table B .Then i delete the record from Table A where prefix is '4422' .so that computed value for the next prefix '442' should contain the computed value for 442[0-1] and 442[3-9] .Same way it will be happened for ('4411','441','44'....bla...bla).
Thanks in advance.. -
Hi,
I am trying to insert an xml ducument into table.
But because of quotation i the file is not getting inserted.
here is the Insert statement
INSERT INTO MYTABLE3
VALUES(' <catalog>
<book >
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
</catalog>'
The following line causing the error
<title>XML Developer's Guide</title>
can anybody tell me how to solve this problem.
cheers
RRKSimply escape it with another single-quote inside the main content.
For example, try
SELECT 'New Year''s Day' FROM dual;
Hope this helps
Gajanan
Maybe you are looking for
-
I have downloaded a movie onto my iPad but want to watch it on my TV. I have apple TV but the movie is not showing up on my "Rented Movies". How do I do this??
-
One JNLP with different JARs depending on JRE version
Hello everybody! I want to produce one JNLP file that, depending on the user's Java version, loads a particular JAR or not. As an example, Java Activation Framework is included with Java 6 (no download needed), but not with Java 5. This serves just a
-
Connecting iPhone to Apple Wired Keyboard
Hello, I pluged my iPhone 5 to my Apple wired Keyboard in one of the two USB slots that it has under neath. Is there a way to type on your iPhone using this method. If so what settings does it consist of to make it work. Thanks, Rosko
-
Financial And Capacity Planning Charts
Hi folks, In 4.5 version, wWithin Financial And Capacity Planning when I click on View Chart, no chart is displayed. Error - NO Items to display. There are plenty of items with correct financial info. Any specific note or config/service to be made fo
-
I need to create multi select functionality (without using PJC's) where the user is able to select more than one record in a multi record block by using the Ctrl and Shift keys. I know I have done this using Headstart way back in Forms 4.5 -- for the