URGENT update a table with a text that has a single quote in it
Hello, I am trying to update a table with a text that has a single quote in it. I believe I need to use two singles quotes but I am not sure how.
For example:
UPDATE TEST
SET DESCRLONG='Aux fins d'exportations'
WHERE etc...
Should I put 2 singles quotes before the quote in the text?
UPDATE TEST
SET DESCRLONG='Aux fins d'''exportations'
WHERE etc...
Thank you very much :)
The best way depends on the version of Oracle.
But, the quick and universal answer is to use two single quotes
SQL> connect test/test
Connected.
SQL> create table test (descrlong varchar2(128));
Table created.
SQL> insert into test values ('This is a string with a '' single quote');
1 row created.
SQL> select * from test;
DESCRLONG
This is a string with a ' single quote
SQL> update test set descrlong='Aux fins d''exportations'
2 where descrlong like 'T%';
1 row updated.
SQL> select * from test;
DESCRLONG
Aux fins d'exportations
SQL>
Similar Messages
-
Updating a table with a query that return multiple values
Hi,
I'm trying to update a table which contain these fields : ItemID, InventoryID, total amounts
with a query that return these values itemId, inventoryid and total amounts for each items
Mind you, not all the rows in the table need to be updated. only a few.
This what i wrote but doesn't work since the query return multiple values so i can't assign it to journalAmounts.
UPDATE [bmssa].[etshortagetemp]
SET JournalAmounts = (SELECT sum(b.BomQty) FROM [bmssa].[Bom] b
JOIN [bmssa].[SalesLine] sl ON sl.ItemBomId = b.BomId
JOIN [bmssa].[SalesTable] st ON st.SalesId = sl.SalesId
WHERE st.SalesType = 0 AND (st.SalesStatus IN (0,1,8,12,13)) AND st.DataAreaId = 'sdi'
GROUP BY b.itemid, b.inventdimid)
Any advise how to do this task?Remember that link to the documentation posted above that explains exactly how to do this. When you read it which part exactly were you having trouble with?
-
How to update a table with strin that contains &
Hi,
I would like to update ename col of emp table with a string that contains &
update emp set ename = 'tom&jerry' where empno = 7369But this gives an error.Please advice.
Regards,Consult the sql*plus reference manual on how to disable the &
Software engineers should be capable of doing research themselves, please stop abusing this forum to increase your salary by being spoon fed for free.
Sybrand Bakker
Senior Oracle DBA -
How can I update the table with a single query for...
I have a table with columns C1 and C2.
C1 C2
A1 null
A1 null
A1 null
A1 null
A2 null
A2 null
A2 null
A3 null
A4 null
A4 null
I want to update my table with a single query so that I would have data like
C1 C2
A1 1
A1 2
A1 3
A1 4
A2 1
A2 2
A2 3
A3 1
A4 1
A4 2
The updated column C2 has the values like serial no grouped on the column C1.SQL> create table mytable
2 ( c1 varchar2(2)
3 , c2 number(2)
4 )
5 /
Tabel is aangemaakt.
SQL> insert into mytable (c1)
2 select 'A1' from dual union all
3 select 'A1' from dual union all
4 select 'A1' from dual union all
5 select 'A1' from dual union all
6 select 'A2' from dual union all
7 select 'A2' from dual union all
8 select 'A2' from dual union all
9 select 'A3' from dual union all
10 select 'A4' from dual union all
11 select 'A4' from dual
12 /
10 rijen zijn aangemaakt.
SQL> select * from mytable
2 /
C1 C2
A1
A1
A1
A1
A2
A2
A2
A3
A4
A4
10 rijen zijn geselecteerd.
SQL> merge into mytable t1
2 using (select c1
3 , row_number() over (partition by c1 order by null) rn
4 , rowid rid
5 from mytable
6 ) t2
7 on (t1.rowid = t2.rid)
8 when matched then
9 update set c2 = rn
10 when not matched then
11 insert values (null,null)
12 /
10 rijen zijn samengevoegd.
SQL> select * from mytable
2 /
C1 C2
A1 1
A1 2
A1 3
A1 4
A2 1
A2 2
A2 3
A3 1
A4 1
A4 2
10 rijen zijn geselecteerd.Regards,
Rob. -
Updating base table with Materialized View's data
Hi,
In order to update base table with MVs data, I am trying real time data transfer between two databases. One is Oracle 8i and other is Oracle 9i. I have created an updatable MV in 9i on a base table using database link. The base table is in 8i. Materialized View log is created in 8i on base table. MV has to be associated to some replication group, but I am not able to create replication group in 9i to which MV has to be associated. The required packages are not installed.
Replication packages are to be used to create replication group are :
/*Create Materialized View replication group*/
BEGIN
DBMS_REPCAT.CREATE_MVIEW_REPGROUP (
gname => 'TEST_MV_GRP',
master => 'TEST_DATA_LINK',
propagation_mode => 'ASYNCHRONOUS');
END;
But above block is giving error.
Can anyone suggest how to resolve this, or are there any other approaches (by not using replication packages) to update base table with MVs data ?
Thanks,
ShaileshYes, I created link between two databases and was able to update tables on 8i from 9i database using that link.
The error I am getting while creating replication group is :
ORA-06550
PLS-00201 : identifier 'SYS.DBMS_REPCAT_UTL2@'TEST_DATA_LINK' must be declared
ORA-06550
PLS-00201 : identifier 'SYS.DBMS_REPCAT_UNTRUSTED@'TEST_DATA_LINK' must be declared
ORA-06512 : at "SYS.DBMS_REPCAT_UTL", line 2394
ORA-06512 : at "SYS.DBMS_REPCAT_SNA_UTL", line 1699
ORA-06512 : at "SYS.DBMS_REPCAT_SNA", line 64
ORA-06512 : at "SYS.DBMS_REPCAT", line 1262
Is there any other approach which can be used to update base table with MVs data instead of using replication packages ?
Thanks,
Shailesh -
Best way to update a table with disinct values
Hi, i would really appreciate some advise:
I need to reguarly perform a task where i update 1 table with all the new data that has been entered from another table. I cant perform a complete insert as this will create duplicate data every time it runs so the only way i can think of is using cursors as per the script below:
CREATE OR REPLACE PROCEDURE update_new_mem IS
tmpVar NUMBER;
CURSOR c_mem IS
SELECT member_name,member_id
FROM gym.members;
crec c_mem%ROWTYPE;
BEGIN
OPEN c_mem;
LOOP
FETCH c_mem INTO crec;
EXIT WHEN c_mem%NOTFOUND;
BEGIN
UPDATE gym.lifts
SET name = crec.member_name
WHERE member_id = crec.member_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
IF SQL%NOTFOUND THEN
BEGIN
INSERT INTO gym.lifts
(name,member_id)
VALUES (crec.member_name,crec.member_id);
END;
END IF;
END LOOP;
CLOSE c_mem;
END update_new_mem;
This method works but is there an easier (faster) way to update another table with new data only?
Many thanks>
This method works but is there an easier (faster) way to update another table with new data only?
>
Almost anything would be better than that slow-by-slow loop processing.
You don't need a procedure you should just use MERGE for that. See the examples in the MERGE section of the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm
MERGE INTO bonuses D
USING (SELECT employee_id, salary, department_id FROM employees
WHERE department_id = 80) S
ON (D.employee_id = S.employee_id)
WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
DELETE WHERE (S.salary > 8000)
WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
VALUES (S.employee_id, S.salary*.01)
WHERE (S.salary <= 8000); -
Updating a table with billion rows
It was an interview question, what's the best way to update a table with 10 billion rows. Give me your suggestions. Thanks in advance.
svkThe best way to answer questions such as this is NOT with a absolute and specific answer. Instead, discuss your strategy for approaching the problem. The first step is to understand your exact requirement. It is surprising how often people
write update statements with an under-qualified where clause. NEVER update a row that does not need to be updated. For example, a statement like:
update mytable set cola = 'ABC' where id in (1, 45, 212);
Assuming id is unique for the table and the specified values exist in the table, we know 3 rows will be updated. Do all of those rows need to be updated? Think about it. If cola is already set to 'ABC' for any of those rows, we could ignore
those rows and make the update more efficient. To do that, you need to add "and cola <> 'ABC' " to the where clause. That is just one example of understanding exactly what you need to do - and doing only that which needs to be done.
Once you understand exactly what you need to do, you need to analyze the impact of the update and identify any potential issues. Updating a lot of rows can take a lot of time and consume large amounts of log and disk space. What else is using
the table? Can you afford to lock the table for the duration of the update? Are there concurrency issues, regardless of whether you update in batches or in one single statement? When using a batch approach, is there an issue if someone runs
a query against the table (i.e., the result is different from that of the same query run after all updates have been completed)? Are you changing something which is included in an index? Are you changing part of the clustered index?
Ultimately, every question you are asked is (or should be) designed to test your problem-solving skills and your skillset. IMO, it is relatively easy to improve your skillset of any particular tool, language, or environment. The other - not so much
and that is why they are more valuable IMO. -
UPDATING A TABLE WITH SAME INFO FROM ANOTHER TABLE ON THE SAME DB
0down votefavorite
I am trying to update a table with info from another table on the same db with same table name. I just want the info to be the same , no primary key or constraint involve just a straight replacement of records and I keep getting errors WITH THE TABLE not
being recignize. below is my query:
UPDATE
VNDFIL
SET EOBTYP
= VNDFIL.EOBTYP,
EDI_X12_835_VERSION = VNDFIL.EDI_X12_835_VERSION
FROM
AGERECOVERY
WHERE
VNDFIL.EOBTYP
= VNDFIL.EOBTYP
AND
VNDFIL
.EDI_X12_835_VERSION
= VNDFIL.EDI_X12_835_VERSIONHi rotary,
If those two same named tables are in the same database then they have to be in different schemas. If you mean they are in the same server instance, then they may be in different databases, besides the "table not being recognized" error,
anyway you should use the fully qualified table names, that is database.Schema.Table(If across instances, ServerName should be prefixed) to avoid the table unrecognized error.
Using Identifiers As Object Names
With the fully qualified names, your update statement can be like below.
UPDATE
db1.schema1.VNDFIL
SET EOBTYP = srcTbl.EOBTYP, EDI_X12_835_VERSION = srcTbl.EDI_X12_835_VERSION
FROM
db1.schema2.VNDFIL srcTbl
WHERE
db1.schema1.VNDFIL.EOBTYP = srcTbl.VNDFIL.EOBTYP AND
db1.schema1.VNDFIL.EDI_X12_835_VERSION = srcTbl.VNDFIL.EDI_X12_835_VERSION
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Recordset - updating 2 tables with 1 recordset using application object update record
I have a recordset that uses a field from 2 different tables
with a select statement where clause that joins a userid. I can
display the field’s data just fine. Now I want to use the
Application object “update record” so I can modify
either of the fields. The problem is the Application object
“update record” only allows you to update one table.
How does Dreamweaver mx 2004 allow me to update 2 tables with one
recordset and 1 submit button? Currently using php.
Example of where:
Where member.userid = member_detail.userid
I tried creating the one form with the field from the first
table and that works just fine. I added the other field from the
other table into the form but ofcourse there isn’t any code
that will update the second table so it won’t work.
My application requires me to update alot of fields between 2
tables at the same time.
Does anyone know a way using Dreamweaver mx 2004 to do this?
I don’t have much php experience.jon-rookie wrote:
> DreamerJim,
>
> I am sorry but I don't think you are correct. I just
can't believe that with
> all the powers to be at Macromedia and now Adobe can't
figure out how to update
> two tables at once. There are millions of db's out there
that require this. I
> spent several hours today perusing lots of posts on the
internet. It seems I
> am not the only one out there that has asked this
question. Unfortunately
> there are no good answers yet to my surprise.
>
> I did find a Dreamweaver extension that does exactly
what I myself and many
> others want. The problem is it is no longer available
unless you purchase a
> bundle of software from Adobe.
>
> I have not looked into it in detail so I am not 100%
sure that is accurate!
>
> Still, alot of php programmers do this all the time
without much trouble. I
> just want to know if Dreamweaver mx 2004 has the
capability if a person knows
> the right steps.
>
> Hopefully a Dreamweaver expert will post something to
let us know for sure.
> Until then I am stuck.
>
Not even CS3 has this built in, you will either have to code
it yourself
or buy the extension you have found. Dreamweaver gives you
basic
features to help you develop applications, but if you want to
do
anything really clever you have to do it yourself.
One thing to consider is maybe creating an SQL view that is
can be
updated. I am pretty sure it exists, then you use the view
instead of
the table in the update behaviour. I have never done it
myself, but I am
sure it can be done.
Steve -
Is it possible to update multiple tables with a dynamic form?
I have columns from two tables populating a dynamic form. I am trying to have the form update both tables on submit. I have tried both a linked transaction and a custom transaction but I am not making progress. Only the master table is being updated. Is it possible with ADDT to update two tables with a dynamic form?
I meant
SXMSMSTAT
SXMSSYERR
Thanks. -
How to update two tables with trigger
Hi:
how to update two tables with trigger ?
I have two tables :
(1)ASIA
MI number;
(2)ASIA_P
ID number;
When I insert a new value into the asia.MI ,I also can
insert the same value into the asia_p.id field.
I have write a trigger as follows but it does't work.
create or replace trigger MI_TRG
before insert on asia
for each row
declare
seq number;
begin
select MI_SEQ.Nextval into seq from dual;
:new.MI:=seq;
insert into ASIA_PRO(MI_ID)
values
(seq);
end MI_TRG;
How to realize it ?
thanks
zzmWhy do you say it does not work?
-
How do i forward a text that has a sound attachment?
when i recieve a text that has sound , picture and message , my 4s wont let me forward, save to ringtones, or email myself the sound portion. it also separates each one individually even though it was sent as one text . i dont understand why and i've tried to copy the sound and paste it to anything i can think of but it only does the text numbers associated with the sound.
South_Beach wrote:
I was under the impression that the SDK allowed for development. How do you propose that the June update potentially allow for this? Wouldn't a developer need to use the SDK to develop that capability?
You are correct. The SDK would just allow the development of any capability. Whether or not this particular ability can or will be developed is unknown.
By the way...
Here it is March and you are announcing (speculating) a June update. Isn't speculation prohibited by the TOU?
Its not speculation. The iPhone 2.0 update was announced formally at the March 6 roadmap event. Apple officially said June. -
I just spent 3 days creating a book [32 pages], with photos and text but when I click Buy Book In iPhoto this appears>
Our book appears to have default text that has not been edited. Printed books will not include this text. Do you want to continue?
My question is will the text I have sellected to use still be ok, am I safe to continue and buy or will the book have missing text ?
The book is for special birtday in 2 weeks time Please Help.G
<Email Edited by Host>Yes, you're safe to continue. That means that there are text boxes that you did not put any text into and they contain the holding text which will not be printed. That text is shown in a light grayt and is in Latin. Normally you can just put a space in the text box to replace the holding text so as not to get that warning message.
Before ordering the book proof the book according to this Apple document: iPhoto, Aperture: Previewing an order in iPhoto or Aperture. Check the pdf file for any missing text or photos and any warning indicators in the text boxes indicating that some of the text has exceeded the space allotted in the text box.
Keep the pdf file to compare with the printed copy when you reciive it.
OT -
Bought on ipad, can i share with my ipod that has different apple id?
I bought a song on my ipad, and would like to share with my ipod that has a different apple id. How do i do this?
Put all of the music on one computer and sync the idevices to that computer
-
When I click "Buy Now" in iPhoto's book I get the following message: "Your book appears to have default text that has not been edited. Printed books will not include this text. Do you want to continue?"
How do I proceed? How do I identify which is "default text?"What version of iPhoto are you using?
Go thru each page, check the layout to see if there's a text box included on the page and make sure there is text in that text box. If not it may show the "holding" text like this:
If you don't want to change the page layout to one that only has photos and no text boxes just select that holding text and put a space in its place.
OT
Maybe you are looking for
-
Hi I had my iTunes library on an external hard drive which has crashed. The data is unrecoverable. I've now bought a new laptop and I want to rebuild my iTunes library. I found a set of backup discs I created back in 2010 and although they don't repr
-
Gmail push and twitter/facebook notifications not working since ios 5
I have not been getting any push email notifications, the device does not seem to be receiving any mail unless I fetch it manually or wait for the 15 min fetch schedual. Also, I am not getting any of the integrated twitter notifications. Any possible
-
How to open website in a Adobe Reader(8.0)?
The app.launchURL can open website in Adobe Acrobat ,but it donnot work in Adobe Reader,Why?
-
Passing date parameters to a custom folder
Is there any simple way to pass date parmeters to a custom folder?
-
Command line to extract file in windows XP and Windows 7
I want to copy files from a zipped folder of any source to C:\XYZ folder. which command should I use? example: source folder : Ashok.zip This zip folder contains a.txt and ABC folder. Now i have to copy this a.txt and whole ABC folder to C: XYZ usin