How to update a CLOB column
here is my problem.
I have a table called t_clob as follows:
SQL> desc t_clob
Name Null? Type
C CLOB
I need to update an existing row with new data (overwrite). The new data is a big java script string with line break, spaces, alignment etc. as follows :
<form name="abcdeg" accept-charset="utf-8" class="adadad" method="get" action="abd/def" id="asdsdas">
<label class="abcdef" for="sdfgsdgjgerigh">Search</label>
<div class="qwert">
<label class="qwert">
<input type="radio" name="search_type" value="wweer" id="qwert_trye" onclick="aab(ddgdfgdf);switchTo(''abcd'');" class="radio" <#if localchecked??> ${localchecked}</#if> />Site
</label>
<label class="abcdefgh">
<input type="radio" name="asddfere" value="sssd" id="sdfswererwerew" onclick="abcdefghij(this.value);switchTo(''dfsdfs'');" class="radio" <#if webchecked??> ${sdfsdfsdf}</#if> style="display:none" disabled />
<input type="radio" name="sdfsdfsdfs" value="fsdfsdfsdf" id="sdfsdfsdfsd" onclick="sdfsdfsdfsdfsdfsdf(this.value);" class="radio" <#if sfsdfsdfsdf??> ${sdfsdfsdfsdf}</#if> /> qwe
</label>
<label class="sdfdsfsdfs" style="font-size:8px">
sfsdfsdf <br>
<img src="/sdfsd/sdfsd/sfsdfsd.lfg" alt="Search"/>
</label>
<label class="qweqwe" style="display:none">
<input type="radio" name="qwewewqe" value="weqwewq" id="qweqweqwewqeq" onclick="weqweqweqeqweqw(this.value);switchTo(''business'');" class="radio" <#if localbusinesschecked??> ${qweqweweqwe}</#if> />qweqweqw
</label>
</div>
<input type="text" value="<#if q??>${q}</#if>" name="qweqwewqe" id="qweqweqwew" autocomplete="off"/>
<button type="submit" onclick="qweqweqweqw()">
<img src="/weqweqw/qweqweqwe.gif" alt="Search" />
</button>
<input type="hidden" value="<#if sm??>${sm}</#if>" id="sm" name="qwe" class="hidden"/>
<input type="hidden" value="<#if srm??>${srm}</#if>" id="srm" name="srm" class="hidden"/>
<input type="hidden" id="startIndex" name="startIndex" value="<#if start??>${start}</#if>"/>
<input type="hidden" id="currentPage" name="currentPage" value="<#if currentpage??>${currentpage}</#if> "/>
</form>
<script type="text/javascript">
window.qweqwewq = "<#if appid??>${appid}</#if>";
</script>
<script type="text/javascript" src="http://qwewqeqwewewe/qwewq/qwew/qweqwe.js"></script>
Currently, we have the normal update statement (updating as a varchr value) in a .sql file. but running the .sql file, throws the following error:
SP2-0042: unknown command "</script>" - rest of line ignored.
SP2-0734: unknown command beginning "<script ty..." - rest of line ignored.
SP2-0734: unknown command beginning "where EXT..." - rest of line ignored.
For a work-around, we are updating the column through TOAD --> Schema Browser--> Data tab. But, this TOAD way is appearing to be error prone, though it works.
Can anybody help us in modifying the update statement so that it can directly be run from the .sql file and the spacing/ new lines are preserved.
Thanks in Advance.
I'm not 100% sure i understand your problem, is this of any help?
ME_XE?create table t1 (id number, col1 clob);
Table created.
Elapsed: 00:00:00.10
ME_XE?insert into t1 (id) values (1);
1 row created.
Elapsed: 00:00:00.01
ME_XE?
ME_XE?declare
2 my_clob clob default
3 '
4 <form name="abcdeg" accept-charset="utf-8" class="adadad" method="get" action="abd/def" id="asdsdas">
5 <label class="abcdef" for="sdfgsdgjgerigh">Search</label>
6 <label class="qwert">
7 <input type="radio" name="search_type" value="wweer" id="qwert_trye" onclick="aab(ddgdfgdf);switchTo(''abcd'');" class="radio" <#if localchecked??> ${localchecked}</#if> />Site
8 </label>
9 <label class="abcdefgh">
10 <input type="radio" name="asddfere" value="sssd" id="sdfswererwerew" onclick="abcdefghij(this.value);switchTo(''dfsdfs'');" class="radio" <#if webchecked??> ${sdfsdfsdf}</#if> style="display:none" disabled />
11 <input type="radio" name="sdfsdfsdfs" value="fsdfsdfsdf" id="sdfsdfsdfsd" onclick="sdfsdfsdfsdfsdfsdf(this.value);" class="radio" <#if sfsdfsdfsdf??> ${sdfsdfsdfsdf}</#if> /> qwe
12 </label>
13 <label class="sdfdsfsdfs" style="font-size:8px">
14 sfsdfsdf
15 <img src="/sdfsd/sdfsd/sfsdfsd.lfg" alt="Search"/>
16 </label>
17 <label class="qweqwe" style="display:none">
18 <input type="radio" name="qwewewqe" value="weqwewq" id="qweqweqwewqeq" onclick="weqweqweqeqweqw(this.value);switchTo(''business'');" class="radio" <#if localbusinesschecked??> ${qweqweweqwe}</#if> />qweqweqw
19 </label>
20 <input type="text" value="<#if q??>${q}</#if>" name="qweqwewqe" id="qweqweqwew" autocomplete="off"/>
21 <button type="submit" onclick="qweqweqweqw()">
22 <img src="/weqweqw/qweqweqwe.gif" alt="Search" />
23 </button>
24 <input type="hidden" value="<#if sm??>${sm}</#if>" id="sm" name="qwe" class="hidden"/>
25 <input type="hidden" value="<#if srm??>${srm}</#if>" id="srm" name="srm" class="hidden"/>
26 <input type="hidden" id="startIndex" name="startIndex" value="<#if start??>${start}</#if>"/>
27 <input type="hidden" id="currentPage" name="currentPage" value="<#if currentpage??>${currentpage}</#if> "/>
28 </form>
29 <script type="text/javascript">
30 window.qweqwewq = "<#if appid??>${appid}</#if>";
31 </script>
32 <script type="text/javascript" src="http://qwewqeqwewewe/qwewq/qwew/qweqwe.js"></script>
33 ';
34
35 begin
36 update t1 set col1 = my_clob where id = 1;
37 end;
38 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.03
ME_XE?
Similar Messages
-
How to Update a clob column..it gives error string literal too long
I am trying to update a clob column of a table but it gives error string literal too long plz tell me what's the issue
ORA-01704: string literal too longPeeyush wrote:
I am trying to update a clob column of a table but it gives error string literal too long plz tell me what's the issue
ORA-01704: string literal too longThere's a problem with my car. It won't start. Why won't it start? Please tell me!
Oh wait, you can't, because I haven't given you nearly enough information...
In other words, if you would like help in trying to work out where you've gone wrong, you should provide a small enough example of your code that demonstrates the error. We might then actually stand a chance of being able to help you! -
How to update managed metadata column for all file in document library using powershell
Hi,
How to update managed metadata column for all file in document library using powershell?
Any help on it.
Thanks & REgards
Poomani SankaranHi TanPart,
I have changed the code which you have give in order to get the files from SharePoint 2010 Foundation Document Library.But i am getting below error in powershell.
Property 'ListItemCollectionPosition' cannot be found on this object; make sure it exists and is settable.
Could you tell me which is the issues in it?
See the code below.
$web = Get-SPWeb http://ntmoss2010:9090/Site
$list = $web.Lists["DocLib"]
$query = New-Object Microsoft.SharePoint.SPQuery
$query.ViewAttributes = "Scope='Recursive'";
$query.RowLimit = 2000
$caml = '<Where><Contains><FieldRef Name="Title" /><Value Type="Text">Process Documents/Delivery</Value></Contains></Where>' +
'<OrderBy Override="TRUE"><FieldRef Name="ID"/></OrderBy>'
$query.Query = $caml
do
$listItems = $list.GetItems($query)
$spQuery.ListItemCollectionPosition = $listItems.ListItemCollectionPosition
foreach($item in $listItems)
#Cast to SPListItem to avoid ambiguous overload error
$spItem = [Microsoft.SharePoint.SPListItem]$item;
Write-Host $spItem.Title
while ($spQuery.ListItemCollectionPosition -ne $null)
Thanks & Regards
Poomani Sankaran -
I am not sure if this is the correct forum for this question, so please forgive if this is posted in wrong forum.
I am new to working with CLOBs in Oracle. The procedure updates a CLOB column which stores large XML files. The XML files are first moved to the /u04 directory, then we execute the procedure which looks for the XML in /u04, then uses those XML files to update the CLOB column.
The procure works fine in our development environment, but doesn't work in our System Test box. No exceptions are thrown in Sys Test, but when we check the CLOB column it's NULL/empty.
Both Dev and Sys Test environments are on the same physical server.
Is there something in the database setup I should be looking for which may cause this difference in functionality?
Code is below. I'm sure it could be better but this is my first go-around with CLOBs.
Any help is greatly appreciated!
--open CLOB used to clear out old XML in CLOB column
dbms_lob.open(v_pre_clob, dbms_lob.lob_readwrite);
-- prep XML CLOB column for update
UPDATE REPORT_TBL
SET REPORT_XML = v_pre_clob
WHERE REPORT_ID = p_rep_id;
--Close pre-update CLOB
dbms_lob.close(v_pre_clob);
--get a reference to the XML CLOB that needs to be updated
select report_xml
into v_clob
from report_tbl
where report_id = p_rep_id for update;
--open the target CLOB and source report xml file in /u04
dbms_lob.open(v_clob, dbms_lob.lob_readwrite);
dbms_lob.open(v_report_xml_file);
--Load the contents of the xml file in /u04 into the CLOB column
dbms_lob.loadclobfromfile(v_clob, v_xml_file,
dbms_lob.lobmaxsize,
v_destination_offset, v_source_offset,
nls_charset_id('US7ASCII'),
v_language_context, v_warning_message);
--Check for the only possible warning message.
if v_warning_message = dbms_lob.warn_inconvertible_char then
dbms_output.put_line('Warning! Some characters couldn''t be converted.');
end if;
--Close both LOBs
dbms_lob.close(v_clob);
dbms_lob.close(v_xml_file);
null;
EXCEPTION
WHEN OTHERS THEN
v_return_code := SQLCODE;
v_return_mesg := SQLERRM;
DBMS_OUTPUT.PUT_LINE('PROCEDURE update_xml_from_file');
DBMS_OUTPUT.PUT_LINE('RETURN_CODE = ' || v_return_code);
DBMS_OUTPUT.PUT_LINE('RETURN_MESG = ' || v_return_mesg);Sorry, pulled that code from development where it was working.
The issue was the GRANT on the /u04 directory. -
Hello All,
I am trying to query a CLOB column with some text string. Can anyone tell me how to do this. Here is a simple example of my code and the error message I get....
SQL> select title_column from atlas_table where clob_column like '%a%';
select title_column from atlas_table where clob_column like '%e%'
ERROR at line 1:
ORA-00932: inconsistent datatypes
Thanks,
DannySelecting a LOB from a table actually returns the LOB's locator and not the entire LOB value..
and you should have a frontend to retrieve the clob or blob..
if u have you can view/update/..do DML operations on the column
null -
Data updated by another user when trying to update a CLOB column value
I just recently upgraded to version 1.2.1 (Build MAIN-32.13), and since I have, I am now getting this message when editing the text within a CLOB column of a table:
Data you attempted to update was updated by another user. You will have to rollback and refresh the table. Rollback now?
I am confident that no one else is in the table, as I am the only one connected to this DB right now. Also, I have shut down SQL Developer completely and restarted it. Again, I get the same error.
Also, the CLOB is less than 2500 characters, so it's not a limitation with the 4k chars.
I really can't update it easily via SQL because there is formatting in the text (carriage
returns, etc).
Any ideas? Any workarounds?
Thanks,
-VikkiOK. A few things I've noticed as I've played with it more.
1 - It does not happen on EVERY update to a CLOB. (Some save successfully.)
2 - Once I get it on a CLOB, it seems to happen then on every subsequent CLOB.
3 - It's not just one table -- several tables do it.
4 - It's not even just updating CLOB columns -- I just had it happen on a varchar2 column where there is also a CLOB in the table.
Thank you for the instructions on how to see the debug console. Here is what I got as an exception (and sorry for the line wrapping):
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.S
tring
at oracle.dbtools.raptor.controls.celleditor.ResultSetCellEditor$1.actio
nPerformed(ResultSetCellEditor.java:140)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
49)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.S
tring
at oracle.dbtools.raptor.controls.celleditor.ResultSetCellEditor$1.actio
nPerformed(ResultSetCellEditor.java:140)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
49)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
reloadBuffers(): 56 nodes checked in 0.001488707 second(s)
reloadBuffers(): 56 nodes checked in 0.001101633 second(s)
reloadBuffers(): 56 nodes checked in 8.70581E-4 second(s)
reloadBuffers(): 56 nodes checked in 0.00159078 second(s) -
Updating a CLOB column using C++ with ATL
Hello,
I have tables with a single CLOB or BLOB colum with the rest of the columns of type VARCHAR2.
I'm getting a result of E_FAIL when updating a single row, for which I'm attempting to change one of the VARCHAR2 columns and the CLOB column. If I set the status for the CLOB column to DBSTATUS_S_IGNORE, the update succeeds (for the other column). If I set the status for all other columns to DBSTATUS_S_IGNORE and the status for the CLOB column to DBSTATUS_S_OK, it still fails.
If I use a SQL Server data source with the same schema and the same C++ code, the original update succeeds.
The length of the data I'm attempting to store is 11487 characters.
As near as I can tell, the Oracle provider does support this kind of functionality. Perhaps there is some coding variation needed for the Oracle data source. I have so far been unable to find a suitable example (or any code example for the Oracle provider using C++/ATL).
I'm using Oracle 9i Release 2 with the latest OLE DB provider (9.2.0.2.0).
Thanks,
Daniel E. Hale
[email protected]Some additional information on the problem:
I was using the ISequentialStream interface
with a Dynamic Accessor when the problem
occurred.
Since then I've tried using a SQL command to do
the update... and I've found the 11487 characters
is too long... I get a maximum length error when
I try the command in SQL+. (BTW, SQL Server works
fine with the long command.)
I doubt that the length is the reason for the failure
of the update using the ISequentialStream interface.
I'm just looking for something that works. Right
now, the only thing that works is not to do the
update at all, but instead do delete/insert. I'd
like to find a better solution than that.
-Daniel E. Hale -
How to Update a particular column with custom SQL in JHeadstart
Hi Friends,
I was trying to keep an update SQL statement in VO (missing right Parenthesis exception is thrown)
Please to let you know about my Requirement.
I have a column in Sales_Person Table "TARGET' and in Sales_Admin Table "INCENTIVE"
So Admin will allot a particular Amount in Incentive column for all the sales. (i.e globally for one and all)
When a Sales_Person enter a target of some number say 80 in the Target field.
while saving i want to deduct the target from incentive and the result must be update in Incentive column.
can you please suggest me where should i keep this functionality
Can you please help me out in solving this issue.
Thanks in advance.
RahulRahul,
You can do this in the doDMl method of your Entity Object.
See this white paper:
http://www.oracle.com/technology/products/jdev/collateral/papers/10131/businessrulesinadfbctechnicalwp.pdf
If you have follow-up questions, please use the JDeveloper forum, since your question is not related to JHeadstart.
Steven Davelaar,
JHeadstart Team. -
How to update the COST column using another table's column
Dear All,
I have table:
table parts: pno, pname, qoh, price, olevel
table orders: ono, cno, eno, received, shipped
table odetails: ono, pno, qty
view:orders_view: ono, cno, eno, received, shipped,sum(qty*price)order_costview:odetails_view: ono, pno, qty, (qty*price)cost
after I update the price in parts, I need to update COST and ORDER_COST too. The orders_view does not have pno, qty, and price, the odetails_view does not have price, how can I update the COST and ORDER_COST. Please help and Thanks in advance!!!
I wrote the update the price in parts:
create or replace procedure change_price(ppno in parts.pno%type, pprice in parts.price%type) as
begin
update parts
set price = pprice
where pno = ppno;
end;
show errorsthis procedure works fine.
I wrote the trigger:
create or replace trigger update_orders_v
after update of price on parts
for each row
begin
update orders_view
set order_cost = sum(parts.(:new.price)*parts.qty)
where parts.pno = :new.pno;
end;
show errorsIt gives me:Errors for TRIGGER UPDATE_ORDERS_V:
LINE/COL ERROR
3/5 PL/SQL SQL Statement ignored
4/22 PL/SQL ORA-00934: group function is not allowed hereplease help!You could add the columns to the tables and then you would need a trigger to update those columns. However, you could just as easily select the price * qty to get the cost, without creating an additional column or trigger. I have no idea what you might want to do with a global temporary table. I think you need to explain what your purpose is, before any of us can suggest the best method. Since I have already demonstrated an update with a view, I will demonstrate an update with the cost column added to the odetails table and a trigger as you asked about. Notice that you will need triggers on both tables, the one that has qty and the one that has price.
scott@ORA92> create table parts
2 (pno number(5) not null primary key,
3 pname varchar2(30),
4 qoh integer check(qoh >= 0),
5 price number(6,2) check(price >= 0.0),
6 olevel integer)
7 /
Table created.
scott@ORA92> create table odetails
2 (ono number(5),
3 pno number(5) references parts,
4 qty integer check(qty > 0),
5 cost number,
6 primary key (ono,pno))
7 /
Table created.
scott@ORA92> create or replace procedure change_price
2 (ppno in parts.pno%type,
3 pprice in parts.price%type)
4 as
5 begin
6 update parts
7 set price = pprice
8 where pno = ppno;
9 end;
10 /
Procedure created.
scott@ORA92> create or replace trigger update_cost1
2 after insert or update of price on parts
3 for each row
4 begin
5 update odetails
6 set cost = qty * :new.price
7 where pno = :new.pno;
8 end update_cost1;
9 /
Trigger created.
scott@ORA92> show errors
No errors.
scott@ORA92> create or replace trigger update_cost2
2 before insert or update of qty on odetails
3 for each row
4 declare
5 v_price parts.price%type;
6 begin
7 select price
8 into v_price
9 from parts
10 where pno = :new.pno;
11 --
12 :new.cost := :new.qty * v_price;
13 end update_cost2;
14 /
Trigger created.
scott@ORA92> show errors
No errors.
scott@ORA92> insert into parts values (1, 'name1', 1, 10, 1)
2 /
1 row created.
scott@ORA92> insert into odetails values (1, 1, 22, null)
2 /
1 row created.
scott@ORA92> -- starting data:
scott@ORA92> select * from parts
2 /
PNO PNAME QOH PRICE OLEVEL
1 name1 1 10 1
scott@ORA92> select * from odetails
2 /
ONO PNO QTY COST
1 1 22 220
scott@ORA92> -- update:
scott@ORA92> execute change_price (1, 11)
PL/SQL procedure successfully completed.
scott@ORA92> -- results:
scott@ORA92> select * from parts
2 /
PNO PNAME QOH PRICE OLEVEL
1 name1 1 11 1
scott@ORA92> select * from odetails
2 /
ONO PNO QTY COST
1 1 22 242
scott@ORA92> -- select works without extra cost column or trigger:
scott@ORA92> select o.ono, o.pno, o.qty, (o.qty * p.price) as cost
2 from odetails o, parts p
3 where o.pno = p.pno
4 /
ONO PNO QTY COST
1 1 22 242
scott@ORA92> -
How to update a BLOB column in a table with a file in local machine?
I have a file (of XML type) in my local machine. I want to update it in a BLOB column of a table in databse server. Can anyone help me in this regard. Appreciate your help.
Regards
Walter Nicholasuser447427 wrote:
I have a file (of XML type) in my local machine. I want to update it in a BLOB column of a table in databse server. Can anyone help me in this regard.That's the client's job to read data on the client PC (from keyboard/mouse/scanner/file/whatever input) and submit that to the database server for processing and/or storage.
You cannot expect the server to hack into your PC and lift that data in the file from your disk. Not that is not technically possible. You can wire rockets onto a bicycle to make it go faster, but that's not a wise thing to do. Similarly, it is not a bright idea to ignore the very basics of client-server.
Bottom line - you need client s/w on your PC to load the content of that file into Oracle. It can be done using SQL*Loader as already suggested. It can be done using a web browser (submitting it via HTTP to web-enabled PL/SQL code). You can use FTP or WebDav and upload into Oracle's XDB (XML database).
Your requirements will determine what client to use. Once off load? SQL*Loader is very easy to use for loading XML files into the database. -
How to update SharePoint list columns including choice fields programmatically?
Hi All,
I have a requirement to update multiple columns (which are choice columns) in a SharePoint list. I'm a newbie at creating event receivers and timer jobs. Not sure which one to do and where to start first. There are approximately 4500
list items in the lists. I was thinking I could use one list to maintain the Keywords and perform updates or timer job to any targeted lists.
Scenario. Anytime a power user of the sharepoint list wants to update any of the choice field items or possibly even the column name itself, they want to be able to make updates to any of the list
items or other
lists that contain the new name. The columns I'm using are all choice fields named Assigned To, Division, Region, Job Title, Department, and Zone.
Here's sample code for Updating list:
using (SPSite oSPsite = new SPSite("team url/"))
using (SPWeb oSPWeb = oSPsite.OpenWeb())
oSPWeb.AllowUnsafeUpdates = true;
// get the List
SPList list = oSPWeb.Lists["Keywords"];
//Add a new item in the List
SPListItem itemToAdd = list.Items.Add();
itemToAdd["Title"] = "My Title Field";
itemToAdd["Assigned To"] = "Assigned To";
itemToAdd.Update();
// Get the Item ID
listItemId = itemToAdd.ID;
// Update the List item by ID
SPListItem itemToUpdate = list.GetItemById(listItemId);
itemToUpdate["Assigned To"] = "Assigned To Updated";
itemToUpdate.Update();
// Delete List item
SPListItem itemToDelete = list.GetItemById(listItemId);
itemToDelete.Delete();
oSPWeb.AllowUnsafeUpdates = false;
Any help is greatly appreciated. Please provide code sample and references. Thanks!Thanks Ramakrishna -- Here's what I have so far.
namespace MonitorChanges
class MyTimerJob : SPJobDefinition
public MyTimerJob()
: base()
public MyTimerJob(string sJobName, SPService service, SPServer server, SPJobLockType targetType)
: base(sJobName, service, server, targetType)
public MyTimerJob(string sJobName, SPWebApplication webApplication)
: base(sJobName, webApplication, null, SPJobLockType.ContentDatabase)
this.Title = "My Custom Timer Job";
public override void Execute(Guid contentDbId)
// Get the current site collection's content database
SPWebApplication webApplication = this.Parent as SPWebApplication;
SPContentDatabase contentDb = webApplication.ContentDatabases[contentDbId];
// Get a reference to the "ListTimerJob" list in the RootWeb of the first site collection in the content database
SPList Listjob = contentDb.Sites[0].RootWeb.Lists["ListTimerJob"];
// Add a new list Item
SPListItem newList = Listjob.Items.Add();
newList["Title"] = DateTime.Now.ToString();
newList.Update();
Talibah C -
How to update primary key column
Hi,
Can you suggest me best workaround/algorithm for below task:
(Oracle 10g, Solaris OS.)
Situation:
Table P has primary key column "Code", child tables F1, F2, ..., F15 reference with foreign key column "P_Code" column "P.Code", and we don't know which of the child tables has data for particular "P.Code" value.
Task:
Change "P.Code" value from 100 to 200. So that result would be that record P[Code = 100] should be updated as:
update P set
Code = 200
where Code = 100;And child tables column "P_Code" should be updated as:
update F1, F2, .., F15 set
P_code = 200
where P_code = 100;The best solution would be that one very easily can repeat that task.
Edited by: CharlesRoos on 28.12.2010 12:10If you are looking for reusable and repetitive solution, then may be...
SQL> CREATE TABLE p (p_code NUMBER PRIMARY KEY);
Table created.
SQL> INSERT INTO p VALUES(100);
1 row created.
SQL> INSERT INTO p VALUES(300);
1 row created.
SQL> INSERT INTO p VALUES(500);
1 row created.
SQL> commit;
Commit complete.
SQL> CREATE TABLE F1 (p_code NUMBER REFERENCES p(p_code));
Table created.
SQL> CREATE TABLE F2 (p_code NUMBER REFERENCES p(p_code));
Table created.
SQL> CREATE TABLE F3 (p_code NUMBER REFERENCES p(p_code));
Table created.
SQL> INSERT INTO F1 VALUES(100);
1 row created.
SQL> INSERT INTO F3 VALUES(100);
1 row created.
SQL> INSERT INTO F2 VALUES(500);
1 row created.
SQL> commit;
Commit complete.
SQL> CREATE OR REPLACE PROCEDURE update_child_parent(pi_p_code_old NUMBER,
2 pi_p_code_new NUMBER) IS
3 CURSOR table_to_update IS
4 SELECT table_name,
5 to_number(extractvalue(xmltype(DBMS_XMLGEN.getxml('SELECT count(*) c FROM ' ||
6 table_name ||
7 ' WHERE p_code=' ||
8 pi_p_code_old)),
9 '/ROWSET/ROW/C')) cnt
10 FROM user_tables
11 WHERE table_name IN ('F1', 'F2', 'F3');
12
13 BEGIN
14 EXECUTE IMMEDIATE 'ALTER TABLE p DISABLE PRIMARY KEY CASCADE';
15 UPDATE p SET p_code = pi_p_code_new WHERE p_code = pi_p_code_old;
16 FOR i IN table_to_update LOOP
17 IF i.cnt > 0 THEN
18 EXECUTE IMMEDIATE 'UPDATE ' || i.table_name || ' SET p_code=' ||
19 pi_p_code_new || ' WHERE p_code=' || pi_p_code_old;
20 END IF;
21 END LOOP;
22 EXECUTE IMMEDIATE 'ALTER TABLE p ENABLE VALIDATE PRIMARY KEY';
23 END update_child_parent;
24 /
Procedure created.
SQL> EXECUTE update_child_parent(100,200);
PL/SQL procedure successfully completed.
SQL> SELECT * FROM p;
P_CODE
200
300
500
SQL> SELECT * FROM F1;
P_CODE
200
SQL> SELECT * FROM F2;
P_CODE
500
SQL> SELECT * FROM F3;
P_CODE
200
SQL> INSERT INTO p VALUES(300);
INSERT INTO p VALUES(300)
ERROR at line 1:
ORA-00001: unique constraint (HR.SYS_C005931) violated
SQL> EXECUTE update_child_parent(500,900);
PL/SQL procedure successfully completed.
SQL> SELECT * FROM p;
P_CODE
200
300
900
SQL> SELECT * FROM F2;
P_CODE
900
SQL> -
How to update the Artwork column in Itunes 8?
I had to correct some embedded album covers in some MP3 files and Itunes picked this up correctly if I Get Info and look at the album art now. However, the Artwork column in list view will not pick up the change. I had re-added the files to the library, deleted the art and re-added using the Info pane but the artwork column remains on the old art - any ideas?
Hi ,
You have to do a controller extension ,in PFR method use the below code
1.) capture the event of the column for which u are setting the value ,it should fire a ppr event then
super.processFormRequest(pageContext, webBean); OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
String event = pageContext.getParameter("event");
if ("<ItemPPREventName>").equals(event))
// Get the identifier of the PPR event source row
String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
OARow row = (OARow)am.findRowByRef(rowReference);
if (row != null)
Please let me know in case of any issue .
thanks
Pratap -
How to update a column using hibernate
how to update a particular column using hibernate..
iam using oracle databaseI think you didn't get the point. This is a generic Java forum... not a Hibernate forum.
-
Hi,
How should I read a PDF content from some file share location and update a CLOB column in target DB.
My Source is PDF file and target is Oracle DB.
thanks
SanjeevaEasy way of getting LOBs is via external table, this external table below will give you all the file names in a file with name 'files_to_load.dat' and a BLOB column for each file.
Directories used in external table;
create directory dir_data as 'd:\\temp\\data';
create directory dir_out_log as 'd:\\temp\\logs';
create directory dir_out_bad as 'd:\\temp\\logs';
External table definition;
CREATE TABLE blob_data_et
FILE_NM varchar2(120),
file_data blob
organization external
type oracle_loader
default directory dir_data
access parameters
records delimited by NEWLINE
skip 1
logfile dir_out_log:'dir_data.log'
badfile dir_out_bad:'dir_data.bad'
nodiscardfile
fields terminated by ','
missing field values are null
FILE_NM CHAR(120)
column transforms
FILE_DATA FROM LOBFILE (FILE_NM) FROM (dir_data)
location (dir_data:'files_to_load.dat')
reject limit 0
noparallel
nomonitoring;
Cheers
David
Maybe you are looking for
-
Hi , Can anyone tell the following query in 8i is correct ? revoke execute on <procedure name> from public; if it is not please tell me how to revoke a execute permission on a procedure from public in oracle 8i?
-
Error brain 284 impossible to solve
Hi guys ! Iu2019ve recently migrated BW from version 3.5 to version 7. Iu2019ve got a problem with a query. In version 3.5, everything was ok but now that Iu2019m under version 7, thereu2019s a big error when I try to open it with the Bex Analyzer. T
-
How To Remove FLVPlayback Video on Scene with Audio
I was trying to add a video for playback to be used in my Scene on Flash Professional CC. I imported the video and added it to my library, before adding it to my scene frame. My plan was to use the video and have its audio play in the background, whi
-
Audio that is carefully synched to the video in the timeline appears off by several frames once I share the files to Bluray or mp4. I believe, but will double check that I exported to DVD without this issue. Any suggestions for fixes would be greatly
-
Not all selection screen value coming from selection screen only first val
hi i am doing SELECTION-SCREEN BEGIN OF BLOCK gl_ac3 WITH FRAME TITLE text-019. SELECT-OPTIONS: gl_acdp1 FOR gv_gldep1. SELECTION-SCREEN END OF BLOCK gl_ac3. then i am using seelct as below SELECT robukrs rzzhkont FROM zzamd