Parse string into different column and optimization
We are in process of building an audit process for any changes that occur automatically or manually by the user on some of the table data. To do this we have two options:
1. Have master table to store the audit event summary and a detail table to store each column change with old and new values. Something like:
CREATE TABLE TEST_ADT_DTL
EVNT_ID NUMBER,
COL_NAME VARCHAR2(1000),
OLD_COL_VAL VARCHAR2(1000),
NEW_COL_VAL VARCHAR2(1000)
);but this approach has some processing overhead since for the changes to each record there will be multiple records based on number of columns updated. If we are loading 40K transaction twice a month, and the changes are almost 30-40% so the detail table will grow considerably.
2. To have the detail table with one column that will have a concatenated string of changes with field name, old and new values.
CREATE TABLE TEST_ADT_EVNT
EVNT_ID NUMBER,
TBL_NAME VARCHAR2(100),
OPER_CD VARCHAR2(1),
USR_ID VARCHAR2(10),
ACT_DT DATE,
PK_STRNG_VAL VARCHAR2(100),
CMNT_TXT VARCHAR2(1000)
CREATE TABLE TEST_ADT_DTL
EVNT_ID NUMBER,
ADT_LOG VARCHAR2(1000)
INSERT INTO TEST_ADT_EVNT VALUES (1, 'CUSTOMER', 'A', 'ABC', SYSDATE, 'CUS0001', 'SOME COMMENT');
INSERT INTO TEST_ADT_EVNT VALUES (2, 'CUSTOMER', 'U', 'ABC', SYSDATE, 'CUS0001', 'SOME COMMENT');
INSERT INTO TEST_ADT_EVNT VALUES (3, 'ORDER', 'A', 'XYZ', SYSDATE, 'CUS0002', 'SOME COMMENT');
INSERT INTO TEST_ADT_EVNT VALUES (4, 'ORDER', 'U', 'EFG', SYSDATE, 'CUS0002', 'SOME COMMENT');
INSERT INTO TEST_ADT_EVNT VALUES (5, 'ORDER', 'U', 'XYZ', SYSDATE, 'CUS0002', 'SOME COMMENT');
INSERT INTO TEST_ADT_DTL VALUES (2, 'FIELD:CITY,OLD:AVENEL,NEW:EDISON;FIELD:ZIP,OLD:07001,NEW:07056;');
INSERT INTO TEST_ADT_DTL VALUES (4, 'FIELD:ADDRESS,OLD:234 ROGER ST,NEW:124 WEST FIELD AVE;FIELD:STATE,OLD:NJ,NEW:NY;FIELD:PHONE,OLD:,NEW:2012230912;');
INSERT INTO TEST_ADT_DTL VALUES (5, 'FIELD:MID_NAME,OLD:,NEW:JASON;FIELD:ADDRESS,OLD:,NEW:3 COURT CT;');
COMMIT;I want to know if we want to generate a report for audit log, how can I display the data from detail table in columns. I mean how to parse the ADT_LOG column to show the data in three different columns like:
FIELD OLD NEW
CITY AVENEL EDISON
ZIP 07001 07056
.along with the columns from EVNT table.
And, want to know which approach would be better.
hey I think I finally got it using the model clause.
not sure if this will be faster or not.
you can increase the number of iterations if you are not hitting them all,
( the lower your iteration number the faster this will run)
select adt_log, field, old, new from
with TEST_ADT_DTL as
(select 2 evnt_id, 'FIELD:CITY,OLD:AVENEL,NEW:EDISON;FIELD:ZIP,OLD:07001,NEW:07056;' ADT_LOG FROM DUAL UNION
select 4, 'FIELD:ADDRESS,OLD:234 ROGER ST,NEW:124 WEST FIELD AVE;FIELD:STATE,OLD:NJ,NEW:NY;FIELD:PHONE,OLD:,NEW:2012230912;' from dual union
select 5, 'FIELD:MID_NAME,OLD:,NEW:JASON;FIELD:ADDRESS,OLD:,NEW:3 COURT CT;' from dual
select evnt_id, adt_log, field, old, new from test_adt_dtl
model return updated rows
partition by (evnt_id)
dimension by ( 0 d)
measures (adt_log, adt_log field, adt_log old, adt_log new, 0 it_num )
rules iterate (50) -- until ?
adt_log[any] = adt_log[0],
field[0] = substr(adt_log[0], instr(adt_log[0],'FIELD',1,1)+6, instr(adt_log[0],',',1,1) - instr(adt_log[0],'FIELD',1,1)-6),
old[0] = substr(adt_log[0], instr(adt_log[0],'OLD',1,1)+4, instr(adt_log[0],',',1,2) - instr(adt_log[0],'OLD',1,1)-4),
new[0] = substr(adt_log[0], instr(adt_log[0],'NEW',1,1)+4, instr(adt_log[0],';',1,1) - instr(adt_log[0],'NEW',1,1)-4),
field[iteration_number ] = substr(adt_log[0],
instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6,
(instr(adt_log[0],',',( instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6 ),1)
( instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6))
old[iteration_number ] = substr(adt_log[0],
instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4,
(instr(adt_log[0],',',( instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4 ),1)
( instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4))
new[iteration_number] = substr(adt_log[0],
instr(adt_log[0],'NEW:',1,iteration_number + 1 ) + 4,
(instr(adt_log[0],';',1,iteration_number + 1)
(instr(adt_log[0],'NEW:',1,iteration_number + 1 ) + 4)
order by evnt_id, it_num
where new is not nullEdited by: pollywog on Apr 13, 2010 10:28 AM
Similar Messages
-
Breaking the string into different columns
Hi Guys,
I need to break the following string into different columns
'XXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007.'
I am trying to write it using instr and substr , but having some issues .
Is there any other way to do this. If not can someone help me , below is the query that i am working on
SELECT SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', 1, INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1) - 1) col1,
SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007',
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1) + 1,
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1, 2)
- INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1)
- 1
) col2,
SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007',
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 2) + 1,
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 1)
- INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 2)
- 1
) col3
from dual
It is very urgent.
Thanks in advance.npejavar wrote:
It is very urgent.
It doesn't look urgent, you could simply read the manuals for instr and substr or describe any issues or errors you are having, or post sample data so people could help you more easily, or format your code so it is more readable, but you don't bother to do any of those things so if it isn't important to you to extend any effort, why would it be important to us?
If it was really urgent it would be a violation of the conditions of use of these forums.
http://www.catb.org/esr/faqs/smart-questions.html#urgent
http://www.oracle.com/html/terms.html
>
4. Use of Community Services
Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle -
How to parse a delimited string and insert into different columns?
Hi Experts,
I need to parse a delimited string ':level1_value:level2_value:level3_value:...' to 'level1_value', 'level2_value', etc., and insert them into different columns of one table as one row:
Table_Level (Level1, Level2, Level3, ...)
I know I can use substr and instr to get level value one by one and insert into Table, but I'm wondering if there's better ways to do it?
Thanks!user9954260 wrote:
However, there is one tiny problem - the delimiter from the source system is a '|' When I replace your test query with | as delimiter instead of the : it fails. Interestingly, if I use ; it works. See below:
with t as (
select 'str1|str2|str3||str5|str6' x from dual union all
select '|str2|str3|str4|str5|str6' from dual union all
select 'str1|str2|str3|str4|str5|' from dual union all
select 'str1|str2|||str5|str6' from dual)
select x,
regexp_replace(x,'^([^|]*).*$','\1') y1,
regexp_replace(x,'^[^|]*|([^|]*).*$','\1') y2,
regexp_replace(x,'^([^|]*|){2}([^|]*).*$','\2') y3,
regexp_replace(x,'^([^|]*|){3}([^|]*).*$','\2') y4,
regexp_replace(x,'^([^|]*|){4}([^|]*).*$','\2') y5,
regexp_replace(x,'^([^|]*|){5}([^|]*).*$','\2') y6
from t;
The "bar" or "pipe" symbol is a special character, also called a metacharacter.
If you want to use it as a literal in a regular expression, you will need to escape it with a backslash character (\).
Here's the solution -
test@ORA11G>
test@ORA11G> --
test@ORA11G> with t as (
2 select 'str1|str2|str3||str5|str6' x from dual union all
3 select '|str2|str3|str4|str5|str6' from dual union all
4 select 'str1|str2|str3|str4|str5|' from dual union all
5 select 'str1|str2|||str5|str6' from dual)
6 --
7 select x,
8 regexp_replace(x,'^([^|]*).*$','\1') y1,
9 regexp_replace(x,'^[^|]*\|([^|]*).*$','\1') y2,
10 regexp_replace(x,'^([^|]*\|){2}([^|]*).*$','\2') y3,
11 regexp_replace(x,'^([^|]*\|){3}([^|]*).*$','\2') y4,
12 regexp_replace(x,'^([^|]*\|){4}([^|]*).*$','\2') y5,
13 regexp_replace(x,'^([^|]*\|){5}([^|]*).*$','\2') y6
14 from t;
X Y1 Y2 Y3 Y4 Y5 Y6
str1|str2|str3||str5|str6 str1 str2 str3 str5 str6
|str2|str3|str4|str5|str6 str2 str3 str4 str5 str6
str1|str2|str3|str4|str5| str1 str2 str3 str4 str5
str1|str2|||str5|str6 str1 str2 str5 str6
4 rows selected.
test@ORA11G>
test@ORA11G>isotope
PS - it works for semi-colon character ";" because it is not a metacharacter. So its literal value is considered by the regex engine for matching.
Edited by: isotope on Feb 26, 2010 11:09 AM -
How to Store Encrypted String into OracleDatabase Column(vacrchar2)
Hi..
I encountered an error while inserting a Encryted String into oracle column.. Error "Quoted String Doesn't terminated properly"
But i wrote Query string correctly and using Datatypes as String and vacharchar2(2000) in java and oracle respectively..
what i need to do?Hi,
if your code compose the sql programmatically without bind variables i.e.:
String sqlInsert="insert into table A(encrypted_column) values ('" + encryptedValue+ ')");
then if the string encryptedValue contains a ' character you end up with a wrong sql statement
if you encryped values is something like AAABB#??£££'AAA the corresponding sql is
insert into table A(encrypted_column) values ('AAABB#??£££'AAA')
which is not correct becaus of the ' in the middle of the string.
Giovanni -
How to insert a very long string into a column of datatype 'LONG'
Can anyone please tell me how can I insert a very long string into a column of datatype 'LONG'?
I get the error, ORA-01704: string literal too long when I try to insert the value into the table.
Since it is an old database, I cannot change the datatype of the column. And I see that the this column already contains strings which are very long.
I know this can be done using bind variables but dont know how to use it in a simple query.
Also is there any other way to do it?Hello,
To preserve formatting in this forum, please enclose your code output between \ tags. And when executing you code as a pl/sql or sql script
include following lineset define off;
Your code or output goes here
\Regards
OrionNet -
Splitting one column into different columns.
Hello Experts,
How do i split datetime column into different columns while doing a Select statement.
Ex:
The column "REC_CRT_TS" has data like "2014-05-08 08:23:09.0000000".The datatype of this column is "DateTime". And i want it in SELECT statement like;
SELECT
YEAR(DATETIME) YEAR,
MONTH(DATETIME) MONTH,
DATENAME(DATETIME) MONTHNAME,
DATEPART(DATETIME) WEEKNUM,
DAY(DATETIME) DATE,
DATEPART(DATETIME) HOUR
FROM TABLE_NAME;
The output should look like this;
--YEAR| MONTH | MONTHNAME| WEEKNUM | DATE | HOUR
--2014| 5 | May | 25 | 08 |08
Any suggestions please.
Thanks!
RahmanI made a very quick research and I see in this blog post
http://www.jamesserra.com/archive/2011/08/microsoft-sql-server-parallel-data-warehouse-pdw-explained/
that It also uses its own query engine and not all features of SQL
Server are supported. So, you might not be able to use all your DBA tricks. And you wouldn’t want to build a solution against SQL Server and then just hope to upsize it to Parallel Data Warehouse Edition.
So, it is quite possible that this function doesn't exist in PDW version of SQL
Server. In this case you may want to implement case based month name or do it in the client application.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
How to display rows of data into different columns?
I'm new to SQL and currently this is what I'm trying to do:
Display multiple rows of data into different columns within the same row
I have a table like this:
CREATE TABLE TRIPLEG(
T# NUMBER(10) NOT NULL,
LEG# NUMBER(2) NOT NULL,
DEPARTURE VARCHAR(30) NOT NULL,
DESTINATION VARCHAR(30) NOT NULL,
CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T#, LEG#),
CONSTRAINT TRIPLEG_UNIQUE UNIQUE(T#, DEPARTURE, DESTINATION),
CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T#) REFERENCES TRIP(T#) );
INSERT INTO TRIPLEG VALUES( 1, 1, 'Sydney', 'Melbourne');
INSERT INTO TRIPLEG VALUES( 1, 2, 'Melbourne', 'Adelaide');
The result should be something like this:
> T# | ORIGIN | DESTINATION1 | DESTINATION2
> 1 | SYDNEY | MELBORUNE | ADELAIDE
The query should include the `COUNT(T#) < 3` since I only need to display the records less than 3. How can I achieve the results that I want using relational views???
Thanks!!!T#
LEG#
DEPARTURE
DESTINATION
1
1
Sydney
Melbourne
1
2
Melbourne
Adelaide
1
3
Adelaide
India
1
4
India
Dubai
2
1
India
UAE
2
2
UAE
Germany
2
3
Germany
USA
On 11gr2, you may use this :
SELECT t#,
REGEXP_REPLACE (
LISTAGG (departure || '->' || destination, ' ')
WITHIN GROUP (ORDER BY t#, leg#),
'([^ ]+) \1+',
'\1')
FROM tripleg
where leg#<=3
GROUP BY t#;
Output:
1 Sydney->Melbourne->Adelaide->India
2 India->UAE->Germany->USA
Cheers,
Manik. -
Changing rows into different column names
Hi,
i need to tranpose the rows into differnent column names
my sample data :
id , val
1 3
1 4
1 5
into
id , val1, val2 , val3 , val4 ... valn ..
1 3 4 5
from askTom's i see that it's tranpose into a single column using the ref cursor ?
how can i do made it into different column names ?
kindly advise
tks & rdgsFor example, lets say that you want to order your columns from least value to greatest and that you'll never have more than three values per id. Then you can use the analytic function row_number() like this to create a pivot value.
select id, val,
row_number() over (partition by id order by val) as rn
from your_table;And so your pivot query ends up looking like this.
select id,
max(case when rn=1 then val end) AS val1,
max(case when rn=2 then val end) AS val2,
max(case when rn=3 then val end) AS val3
from (
select id, val,
row_number() over (partition by id order by val) as rn
from your_table
group by id;But notice that I started out by making up answers to Justin's questions. You'll have to supply the real answers. -
My touch screen is not responding, I have reset the phone, plugged into different charger and tried to update it to itunes but they will not connect because I cannot put my passcode in, HELP please!
ME TOO. NOW MY IPHONE 6 PLUS IS SAME LIKE YOU.
iphone is diabled- connect to iTunes because i forget passcode.
i cannot connect iTunes because it's always asking to enter passcode on iphone.
So, i cannot make restore my iphone 6+. And then, I cann't erase "device" in icloud.
My iphone is new. No icloud. didn't connect to itune backage.
That's why I try to connect iTunes but it need to enter passcode.
So, my iphone just keep "iphone is disbled-connect to iTunes".
IPHONE 6 PLUS -
How to Splilit The String Into Single Column using Comma As Delimiter ?
How to Splilit The String Into Single Column using Comma As Delimiter ?
using Functionrefer my thread ,code is also available see if that helps you
error while executing the sp ORA-21779: duration not active -
Hi All,
Hoping you are able to help.
I have a table of approx 16 items that I need to split,
EG:
CUSTOMER ACCEPTANCE - HAS BEEN DECLINED - DO NOT APPLY TO ACCOUNT
CUSTOMER ACCEPTANCE - HAS BEEN ACCEPTED - APPLY TO ACCOUNT
CUSTOMER ACCEPTANCE - PENDING DECLINE - ESCALATION REQUIRED - RAISED IN PORTAL
ESCALATION - RAISED - PENDING
ESCALATION - NOT RAISED - STILL TO BE PROCESSED
I need to Keep the first two sections, eg CUSTOMER ACCEPTANCE - HAS BEEN DECLINED in one column, and split off the remaining, eg DO NOT APPLY TO ACCOUNT into a new TEMP table to insert as a column into an existing table.
With little SQL experience, I am having difficulties as they are all of different lengths / criteria etc. Some have 3 hyphens whilst others have 4+
Is anyone able to help point me in the right direction with this request? I will be greatly appreciated.
Kind Regards,
BTMMPIf you're trying to do this all in a SQL query or stored procedure, then you'll probably get better results on the SQL Server forums. However, if you're working with a PowerShell or VBScript that's doing the work, you're in the right place.
Here's one example of how you could do what you're describing. By the way, what do you want to do with the string "CUSTOMER ACCEPTANCE - PENDING DECLINE - ESCALATION REQUIRED - RAISED IN PORTAL"? Should that be split into "CUSTOMER ACCEPTANCE
- PENDING DECLINE" and "ESCALATION REQUIRED - RAISED IN PORTAL", or "CUSTOMER ACCEPTANCE - PENDING DECLINE - ESCALATION REQUIRED" and "RAISED IN PORTAL"?
(In other words, should the script only split off whatever's after the final hyphen, or should it grab the first two pieces of text and split off everything else?)
Here's an example in PowerShell which assumes that you want to separate out all text after the final hyphen in a string. It uses a regular expression, though you could accomplish the same thing with Split, Join and Trim operations, if you prefer.
$string = 'CUSTOMER ACCEPTANCE - HAS BEEN ACCEPTED - APPLY TO ACCOUNT'
if ($string -match '(.*?)\s*-\s*([^-]*)$')
$split = $matches[1], $matches[2]
else
$split = $string, ''
Write-Host "Original String: $string"
Write-Host "First Text : $($split[0])"
Write-Host "Second Text : $($split[1])" -
My Example :
Before:
Columns
name
address
jon DFG
has NULL
adil DER
After:
Column
Total
name : jon , address : DFG
name : has
name : adil , address : DERWhy not doing such reports on the client site?
create table #t (name varchar(10),address varchar(20))
insert into #t values ('jon','dfg'),('has',null),('adil','der')
select n,case when right(n,1)=':' then replace(n,'address:','') else n end
from
select concat('name:',name, ' address:',address ) n from #t
) as der
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How can I put a stl::vector string into the DB and then get it out?
Hello,
As the title, here's a test case with problems,but anyway you can still run it. ( VC6/XP-32/BDB 4.7 )
I know this may be wrong,and I'd like to know how can I do this.
Can someone help me please? I would appreciate it very much.
************ Copy,Compile and Run ***************
#include <iostream>
#include <vector>
#include "db_cxx.h"
int main()
std::string dbName("database.db");
u_int32_t db_flags=DB_CREATE;
Db* db=NULL;
// Prepare key(int)/data(vector<string>) pair.
int int_key=2;
std::vector<std::string> rec_data;
rec_data.push_back("apple");
rec_data.push_back("Bob");
rec_data.push_back("Me");
// Prepare Dbt for receiving.
std::vector<std::string> rec_readData;
Dbt readData;
readData.set_data(&rec_readData);
readData.set_ulen(sizeof(rec_readData));
readData.set_flags(DB_DBT_USERMEM);
try
// Open database.
db = new Db(NULL,0);
db->open(NULL,dbName.c_str(),NULL,DB_BTREE,db_flags,0);
// Put
int ret;
if(ret=db->put(NULL,new Dbt(&int_key,sizeof(int_key)),new Dbt(&rec_data,sizeof(rec_data)),DB_NOOVERWRITE)==0)
std::cout<<"put successful!"<<std::endl;
else { db->err(ret,"Db->put"); }
// Get
if(ret=db->get(NULL,new Dbt(&int_key,sizeof(int_key)),&readData,0)==0)
std::cout<<"get successful!"<<std::endl;
else { db->err(ret,"Db->get"); }
catch(DbException &e)
std::cerr<<"Error: ";
std::cerr<<e.what()<<std::endl;
// Close the database
try
if(db!=NULL)
db->close(0);
catch(DbException &e)
std::cerr<<"Error closing database: ";
std::cerr<<e.what()<<std::endl;
// Display the results.
// Index out of bounds. <-----
std::cout << rec_readData[0].c_str();
std::cout << rec_readData[1].c_str();
std::cout << rec_readData[2].c_str();
system("pause");
// Press any key to go wrong. :(
return 0;
Regards,
legendsinoYou need to convert the std::vector<std::string> into a sequence of bytes. For example, if all strings are shorter than 256 characters, you could create a fresh output string, iterator through the vector, and for each element, append the string length to the output string, followed by the string contents.
Note that ordering in the database will be different from lexicographic order, and you have to keep that in mind when performing range queries. -
Different columns and arrangements in different Folders
I arrange my mail into various folders. For various reasons, I need to have different columns visible and different arrangements of columns in different folders (Kind of like needing From: in InBox and To: in sent items.)
I can't figure out how to set this, by folder and have it 1) stick and 2) not impact other folders.
Help!
Thanks
Johnmust have not worn my glasses when i first checked that feature long time ago, so sorry for the erroneous info in my previous post, and no you cannot change column view whether within one email account or across email accounts. yikes, need to be more careful when i send info on these pages
-
Loading UTF-8 String into CLOB column
Hello!
I am trying to load UTF-8 encoded strings into a CLOB column in an Oracle 9i database from VB.Net using ODP.Net (9.2.0.414).
The strings are XML snippets (Microsoft WordML to be precise). Each corresponds to a record which already exists in the database, therefore I do an update to add the UTF-8 string.
Some of the XML snippets contain characters which once inserted look like upside down question marks (characters represented by 0x92 and 0x96 for example end up as 0xBF once in the database).
Setting breakpoints in Visual Studio, I can watch the string values in the 'Locals' window and they appear correct (in fact I can copy from the 'Locals' window and using a tool such as TOAD can paste the strings into the database successfully). Pasting through TOAD, the characters are properly represented in the database (ie 0x92 is 0x92).
I've tried a number of approaches with no luck.
Any advice/suggestion are most welcome. Thanks!
Here is my code:
strConnectionString = ConfigurationSettings.AppSettings.Item("ConnectionString")
strComponentsTable = ConfigurationSettings.AppSettings.Item("ComponentsTable")
objConnection = New OracleConnection(strConnectionString)
objCommand = objConnection.CreateCommand()
objCommand.CommandType = CommandType.Text
objCommand.CommandText = "UPDATE " & strComponentsTable & " SET TEMPLATE_COMPONENT_CONTENT = :p_content WHERE TEMPLATE_COMPONENT_ID = :p_id"
objConnection.Open()
For Each strId In objComponents.Keys
strContent = objComponents.Item(strId)
objCommand.Parameters.Clear()
objParameter = objCommand.CreateParameter()
objParameter.ParameterName = "p_content"
objParameter.OracleDbType = OracleDbType.Clob
objParameter.Direction = ParameterDirection.Input
objParameter.Value = strContent
objCommand.Parameters.Add(objParameter)
objParameter = objCommand.CreateParameter()
objParameter.ParameterName = "p_id"
objParameter.OracleDbType = OracleDbType.Int32
objParameter.Direction = ParameterDirection.Input
objParameter.Value = CInt(strId)
objCommand.Parameters.Add(objParameter)
intResult = objCommand.ExecuteNonQuery()
NextSome further research has revealed the following:
Two of the characters I provided as examples of not being stored properly in the database are (in Unicode) U+2013 and U=2019. These characters, encoded as UTF-8 should each be three bytes (0xE2 80 93 and 0xE2 80 99 respectively). Sent via VB.Net and ODP.Net they both end up in the database as one byte each (0xBF). Copy and Pasted via TOAD they end up as one byte each (0x92 and 0x96 respectively).
The NLS settings on the server side are:
NLS_CHARACTERSET = WE8ISO8859P1
NLS_NCHAR_CHARACTERSET = AL16UTF16
I have tried using both CLOB and NCLOB column with the results being identical.
Not sure what else to try...
Maybe you are looking for
-
Since I downloaded 7.0.6. update I can not connect to the internet. I want to remove it but the ipad air is not showing up in itunes. I get a message do you trust this computer, yes, and then I get software update in not available. What is wrong? Ple
-
Itunes will not read Ipod Nano...
I just got an Ipod Nano for my Windows XP Dell Inspiron 8500. Installed the latest version of Itunes 5... and any 'latest' updated for Ipod software. (uninstalled/reinstalled SEVERAL times) Everytime I open ITunes, I get a message saying: "The softwa
-
How to asign a new report categery to report in hr abap
hi experts, could u please send me step by step procedure for asigning a how to asign a new report categery to report in hr abap. Thanks in advance jaganmohan reddy
-
Change Default Screen Capture Format from PNG to JPG
I'm running Mac OS 10.4.8 on a G5 Duo Core (Power PC). Up until about 10.4.1, my screen captures (Apple-Shift-4) would result in a PDF file. Then they started coming out as PNG files. I would strongly prefer that they default to jpg files, since I ty
-
How do I create a single image using PSE12 from multiple originals in which the originals are still separate (i.e. side by side or arranged in a square)? I could do this in PSE2, but can't find how to get PSE12 to do it. Grecophile55