Database modify element in row
Hi all,
I have a question about the database toolkit. How do I query a particular row in a table and modify an element in that row? By doing this, the database table is getting updated.
Yik
Kudos and Accepted as Solution are welcome!
Solved!
Go to Solution.
When I write sql query, I always use it to get data, and I have never tried to update a table in a database. I didn't know that you can use the querying function to update a table. Thanks, it worked.
Yik
Kudos and Accepted as Solution are welcome!
Similar Messages
-
Using a tool to add, modify or remove rows in a database table
I am making a web application in Sun Java Studio Creator, but I have one specific question. I have a database with table Customers and in the interface of my application an admin can add, modify or remove a customer.
In programs like Microsoft Visual Studio (ASP.NET), you have a standard tool for things like this. You just have to drag and drop a data table, bind it to the database and enable the Edit, Add and Delete links/buttons.
So my question: is there a tool like this in Sun Java Studio Creator too or do I have to write the whole code myself? And if there is a tool, which one and where can I find some more information about this tool. Because I searched it, but did not find a tool like this . Can anyone help me please?
Thank you in advance!Please can you show me your code for the + button, how do you add an instance? And also can you provide a picture of your hierarchy.
To get a field expandable you must set 3 different properties to make it work fine:
1. Object Palette -> 'Check' Allow Multiple Lines
2. Object Palette -> Field Format -> 'Choose' Rich Text
3. Layout Palette -> Size & Position - > Height -> 'Check' Expand to fit -
Jdev Database Adapter - polling updated rows
Hello, I have a question reguarding the polling strategy available in the database adapter.
I set it up and it works great with new inserted rows in the table.
However, it doesn´t capture the updated rows!
For instance, i have the following table:
ID - NAME - AGE
1 -John- 21
2 -Mary- 25
When I insert a new row, it is captured by comparing the last captured ID in the sequencing file.
ID - NAME - AGE
1 -John- 21
2 -Mary- 25
3 -Cindy- 20 <--------- New row
But when i UPDATE an already existing row, it doesnt load the changed row!
ID - NAME - AGE
1 -John- 26 <----------- Age changed, but polling doesnt recognize it!
2 -Mary- 25
3 -Cindy- 20
Is there a way to get this to work? Should I set an special option? Thank you very much.
Im using jdeveloper 11g.Hi John, it depends on which type of polling strategy you are using to poll the new/updated records. You must have the necessary previleges to add the special field and creat triggers or your db team must have.
i.Physical delete polling strategy: Cannot capture the UPDATE operations on the table.This because when the adapter listens to the table, when ever a record is polled, that record is deleted after the polling process. After polling the records, if it is not deleted, then the adapter knows that it’s a updated one but here when a record is polled, it is deleted. So when an adapter encounters a record, it’s a new record to the adapter though the record is updated before the polling cycle). So physical delete cannot capture UPDATED records.
ii. Logical delete polling strategy: The logical delete polling strategy updates a special field of the table after processing each row (updates the where clause at runtime to filter out processed rows).The status column must be marked as processed after polling and the read value must be provided while configuring the adapter. Modified where clause and post-read values are handled automatically by the db adapter.
Usage:
<operation name="receive">
<jca:operation
ActivationSpec="oracle.tip.adapter.db.DBActivationSpec"
PollingStrategyName="LogicalDeletePollingStrategy"
MarkReadField="STATUS"
MarkReadValue="PROCESSED"
This polling strategy captures the updated records only if triggers are added.This is because when the record is polled, its status is updated to 'PROCESSED'. To capture this record if its updated, its status has to be 'UNPROCESSED'. So a trigger has to be added to update the status field to 'UNPROCESSED' whenever the record is updated. Below is the example.
Ex:
CREATE OR REPLACE TRIGGER nameOftrigger_modified
BEFORE UPDATE ON table_name
REFERENCING NEW AS modifiedRow
FOR EACH ROW
BEGIN
*:modifiedRow.STATUS :='UNPROCESSED';*
END;
In this example, STATUS is the special field(of the polling table). When the record is updated, the trigger gets fired and updates the STATUS field to 'UNPROCESSED'. So when the table is polled, as this record's status is Unprocessed, this record ll be captured during polling.
Other polling strategeis like "Sequencing Table Last Updated","Sequencing Table Last-Read Id" Polling strategy,etc also can be used to capture the updated records. In these strategies also, you need to add the triggers like the above. These need an extra helping table also to poll.
Logical delete polling strategy is good enough to poll the updated records.
Hope this helps.
Thank you. -
Problem with database control returning multiple rows as Array using Oracle
Has anybody using Oracle gotten a Database control that
returns multiple rows to work returning an array?
The only way I can seem to return multiple rows is by returning
a RowSet. Returning an array gives me a NullPointerException
(when called within a pageFlow). When calling a database control
that returns an array from a web service I get a
"java.sql.SQLException: ResultSet has no more data." error.
The samples using the pointbase database seem to work, but when I
converted the CustomerDBClient web service to use Oracle, it starts
failing on calling the database control that returns an array
with: "java.sql.SQLException: ResultSet has no more data."
Has anybody gotten this to work using Oracle?
I'm also having some problem returning an Iterator. It seems
to work when called from a web service, but returns nothing
if called from a page flow.
I'm using Oracle 8.1.7 and WebLogic 8.1.
EricDo you need a particular service pack installed to return an array of custom object?
I am getting a ResultSet contained no data error when trying.
Thanks,
-Thomas
"Robin Karlin" <[email protected]> wrote:
>
Eddie O'Neil <[email protected]> wrote:
All--
Unfortunately, returning an Iterator to a JPF (or JSP) from a
database control is broken in WLW 8.1, though it will work inside of
a
JWS or JCS.
There shouldn't be a problem with returning an array of objects out
of Oracle to the JPF, and if you need an Iterator specifically, youcan
wrap the array in an Iterator implementation.
Sorry for the inconvenience.
Eddie
Lenny wrote:
I have gotten it to work on Oracle using Array:)
However, I haven't gotten it to work on Oracle using Iterator:( Itis so
simple, but doesn't work:(
"Eric Dokken" <[email protected]> wrote in message
news:[email protected]...
Has anybody using Oracle gotten a Database control that
returns multiple rows to work returning an array?
The only way I can seem to return multiple rows is by returning
a RowSet. Returning an array gives me a NullPointerException
(when called within a pageFlow). When calling a database control
that returns an array from a web service I get a
"java.sql.SQLException: ResultSet has no more data." error.
The samples using the pointbase database seem to work, but when I
converted the CustomerDBClient web service to use Oracle, it starts
failing on calling the database control that returns an array
with: "java.sql.SQLException: ResultSet has no more data."
Has anybody gotten this to work using Oracle?
I'm also having some problem returning an Iterator. It seems
to work when called from a web service, but returns nothing
if called from a page flow.
I'm using Oracle 8.1.7 and WebLogic 8.1.
Eric
I get the same error that Eric reported when trying to return an Array
of objects.
It is really frustrating because I can't use much of the built-in control
logic
that WLW provides. All I did was create a data pool for Oracle and a
datasource.
I modified the sample app in C:\bea81\weblogic81\samples\workshop\SamplesApp\WebApp\callJavaControl
to point to that datasource and I get the error that Eric reports above.
Can
anyone help me out????
Thanks,
Robin -
ALTER DATABASE/MODIFY FILE issue
Greetings to all --
We are running SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64), and running into what seems like a bug. One of the largest tables was moved to a separate file group a while ago, and now a large percentage of the rows from that table (about 50GB) , need to
be removed.
We wanted to reduce the amount of transaction log growth and the duration required for the delete. Recovery model was set to BULK_LOGGED before executing the following steps:
1. create a new filegroup
2. create a new file in that filegroup
3. set the new filegroup to be the DEFAULT filegroup
4. SELECT INTO new_table from original_table WHERE filter_condition
5. drop original_table
6. rename new_table to original_table
7. remove original file from original filegroup
8. remove original filegroup
9. MODIFY the logical name of the new file to be the same as the logical name of the original logical name.
ALTER DATABASE myDB
MODIFY FILE ( NAME = new_logicalname, NEWNAME = original_logicalname)
This fails:
Msg 1828, Level 16, State 3, Line 1
The logical file name "original_logicalname" is already in use. Choose a different name.
I noticed that the original filegroup still persisted until I did a transaction log backup, but after that , there is no entry for that file in sys.databasefiles for that database.
Checking sp_helpdb for that database shows only the new logical file name.
Any thoughts would be much appreciated.This scenario is easily reproduced, and seems not to be "by design".
I put my bets on Sean and say "by design".
I can't put my finger on it, but it has to with doing restores, and particularly log restores. It does not seem to happen with a database in simple recovery. But for a database in full (or bulk_logged) recovery, there lingers a row in sysfiles1 and sysprufiles
for the dropped file.
sys.database_files is a view over sys.sysprufiles and it does not display the deleted file, but it is there with a certain status.
In any case, I can't see that this is the end of the world. It is not likely that you refer to the name of that fill all around the house. But the next time you do this manouvre, you may want to rename the existing file before you drop it and create
the new one.
Erland Sommarskog, SQL Server MVP, [email protected] -
How to change the display view of the records and modified into a row
I have a SQL which can count the condition(Bad,Poor,Worse) in a day and group it into a month and displays as follows:
YEARS MONTHS LV COUNTVAL
2009 Apr Bad 5
2009 Apr Poor 3
2009 Apr Worse 2
2009 Aug Bad 3
2009 Aug Poor 2
2009 Aug Worse 5
2009 Dec Bad 5
2009 Dec Poor 2
2009 Dec Worse 3
2009 Feb Bad 5
2009 Feb Poor 3
2009 Feb Worse 2
2009 Jan Bad 3
2009 Jan Poor 3
2009 Jan Worse 4
2009 Jul Bad 2
2009 Jul Poor 3
2009 Jul Worse 5
2009 Jun Bad 1
2009 Jun Poor 4
2009 Jun Worse 5
2009 Mar Bad 4
2009 Mar Poor 4
2009 Mar Worse 2
2009 May Bad 3
2009 May Poor 5
2009 May Worse 2
2009 Nov Bad 1
2009 Nov Poor 5
2009 Nov Worse 4
2009 Oct Bad 5
2009 Oct Poor 3
2009 Oct Worse 2
2009 Sep Bad 2
2009 Sep Poor 4
2009 Sep Worse 4
2010 Apr Bad 6
2010 Apr Poor 1
2010 Apr Worse 3
2010 Aug Bad 3
2010 Aug Poor 2
2010 Aug Worse 5
2010 Dec Bad 4
2010 Dec Poor 2
2010 Dec Worse 4
2010 Feb Bad 4
2010 Feb Poor 3
2010 Feb Worse 3
2010 Jan Bad 6
2010 Jan Poor 3
2010 Jan Worse 1
2010 Jul Bad 2
2010 Jul Poor 4
2010 Jul Worse 4
2010 Jun Bad 4
2010 Jun Poor 3
2010 Jun Worse 3
2010 Mar Bad 6
2010 Mar Poor 1
2010 Mar Worse 3
2010 May Bad 4
2010 May Worse 6
2010 Nov Bad 5
2010 Nov Poor 2
2010 Nov Worse 3
2010 Oct Bad 3
2010 Oct Poor 3
2010 Oct Worse 4
2010 Sep Bad 3
2010 Sep Poor 4
2010 Sep Worse 3The SQL that I am using:
select years, months, lv, countVal
from
select years, months, lv, count (lv) OVER (PARTITION BY years,months,lv) countVal from
SELECT x.years, x.months, x.days, x.lv
FROM airtest,
XMLTABLE ('$d/cdata/name' passing xmldoc as "d"
COLUMNS
years integer path 'year',
months varchar(3) path 'month',
days varchar(2) path 'day',
lv varchar(5) path 'value'
) as X
group by x.years, x.months, x.days, x.lv
order by x.years, x.months, x.days
group by years, months, lv, countVal
order by years,monthsThe problem for now is how to modify it to become in this format??
YEARS MONTHS Bad Poor Worse
2009 Apr 5 3 2
2009 Aug 3 2 5
2009 Dec 5 2 3
.........After modified, It will become something like this.
You can see the seperated data are group into a row in each month.
Thanks for help!!Thanks for you suggestion!
But it seems the order become quite strange after i used...
Belows are the display....
YEARS MONTHS BAD POOR WORSE SUM_BY SUM_PY SUM_WY
2009 Jan 3 3 4 39 41 40
2009 Feb 5 3 2 39 41 40
2009 Dec 5 2 3 39 41 40
2009 Nov 1 5 4 39 41 40
2009 Oct 5 3 2 39 41 40
2009 Sep 2 4 4 39 41 40
2009 Aug 3 2 5 39 41 40
2009 Jul 2 3 5 39 41 40
2009 Jun 1 4 5 39 41 40
2009 May 3 5 2 39 41 40
2009 Apr 5 3 2 39 41 40
2009 Mar 4 4 2 39 41 40
2010 Jan 6 3 1 50 28 42
2010 Nov 5 2 3 50 28 42
2010 Oct 3 3 4 50 28 42
2010 Sep 3 4 3 50 28 42
2010 Aug 3 2 5 50 28 42
2010 Dec 4 2 4 50 28 42
2010 Jun 4 3 3 50 28 42
2010 May 4 0 6 50 28 42
2010 Apr 6 1 3 50 28 42
2010 Mar 6 1 3 50 28 42
2010 Feb 4 3 3 50 28 42
2010 Jul 2 4 4 50 28 42
TO_DATE ( years || months, 'yyyyMon', 'NLS_DATE_LANGUAGE=English') ymI have tried to added this statement both in the "SELECT" or end of the sql (as the position of yours "order by"), It does not work... -
Update rows in Database reading field in rows of selectoneListBox
JDev 11.1.1.4, application JSF.
I have a .jspx that contain a af:table with 20 rows. These rows are read from database.
I have (in the same .jspx) a af:selectoneListBox with f:selectItems.
I use drag and drop from table to selectoneListBox. I save into af:selectItems the first field of each row choice.
Now, how can I put a button than when I press it, it makes a change in database (View Objects) passing as parameter the field reads in row of selectoneListBox.
ThanksThanks for your replay Kamaal,
but I have thought another way.
I'd like to write something like:
update filea set field1='1' where field2 in (getSelectedItems())
where getSelectedItems() contain the fields read in rows of selectoneListBox.
But, I do not know where I have to write this sql statement and then how to execute it by pressing a button, maybe in the ViewObjectImpl ? and if yes, how?
Thanks -
"For explaination , like this
1 1 1 1 1 1 1 ....... to 640
+2 2 2 2 2 2 2 .......
+3 3 3 3 3 3 3 .......
=6 6 6 6 6 6 6 ....... this is the final 1D array of summed elements."
Appreciate the sample VI's but I can't open them ( I have Labview 5.01 )Here is Mikael solution, expanded to include rows and ready to use as a subVI. Now all is needed is the polymorphic version
www.vartortech.com
Attachments:
Sum_rows_or_colums.vi 25 KB -
Database Adapter - Polling updated rows
Hello, I have a question reguarding the polling strategy available in the database adapter.
I set it up and it works great with new inserted rows in the table.
However, it doesn´t capture the updated rows!
For instance, i have the following table:
ID - NAME - AGE
1 -John- 21
2 -Mary- 25
When I insert a new row, it is captured by comparing the last captured ID in the sequencing file.
ID - NAME - AGE
1 -John- 21
2 -Mary- 25
3 -Cindy- 20 <--------- New row
But when i UPDATE an already existing row, it doesnt load the changed row!
ID - NAME - AGE
1 -John- 26 <----------- Age changed, but polling doesnt recognize it!
2 -Mary- 25
3 -Cindy- 20
Is there a way to get this to work? Should I set an special option? Thank you very much.
Im using jdeveloper 11g.Hi John,
I guess you're talking about BPEL? If so, try the BPEL forum for a better response.
Best,
John -
Hi,
I am updating(or Insert) database table in a user - Exit, using MODIFY statement.
On a particualr date, they have created 100 documents. But, in that 96 documents are inserted into the Custom data base table. But, 4 documents are not inserted.
So, can you please tell me. what are the chances of a "MODIFY" statment can fail.
If the 2 users are inserting simultaneuously, is there any chance of fail in MODIFY?
I am not using any locks in my code.
I am not using an Commit work here as this is user exit.
Please help me.
Code :
MODIFY DBTAB from WA.Hi Sandeep,
No Need for locks,
As MODIFY statement automatically sets a database lock until the next database commit or database rollback.
The Possible cause for not updating the records could be.
At least one line could not be processed as there is already a line with the same unique name secondary index in the database table.
means duplicay of records,
For ex 96 records are inserted so these 96 records contains unique entries in there primary key fields, rest 4 records doesn't contain unique entries in primary key fields.
for ex in table MSEG- document number is a key field, so you can not put same material number twice,
Kindly check your data which you are updating in your table, As key fields should have unique entries. This will definately solve your problem.
Thanks
Saurabh siwach -
SCCM database Modified date doesn't change / rebuild indexes
Hi all,
I have 2 questions
1)
We have a month ago upgraded our SCCM environment from SCCM 2012 RTM -> SCCM 2012 SP1 (no CU), and we have upgraded SQL 2008 R2 (CU6) to SQL 2008 R2 SP2.
We have a SCCM 2012 primary site and an SCCM 2012 CAS site from both these sites its database file has not changed its modified date since the data of upgrade (SQL is installed on the same server so the database is local). However the WSUS database and the
reporting DB that exist on the same server updates its modified date.
SCCM is running and all status messages are OK. All component status's are updating and have correct dates based on when e.g. the last backup ran (that is at 6 pm every night) with no errors. To make a long story short, everything works
as it should. Deployments and advertisements and OSD arrive, collections get updated, no errors appear in the log files or in the component or site status, but the database on these servers (CAS and Primary) does not modify its date. SCCM backup of these servers
is running and the database file in that backup also contains the same modified date.
Anyone knows why this happens , or do we have an issue ?
2)
Maintenance task rebuild indexes
Is there a best practice according to the maintenance task rebuild indexes?
In our environment we have not enabled this maintenance task, both sites run for over one year.
Can we enable this task without disturbing or is it a better idea to enable this task in the weekend when there is less workload , and afterwards schedule this task once a week
regards and thx in advance
JohanAs stated “The time stamp will also change if the database files size are expanded as well when the database grow”
does that mean that after our upgrade a month ago the database has not grown with new data??
It depends. Data might have been added to the database (which it was fur sure with ConfigMgr), but the timestamp will only change if the file size was increased too. That has something to do with the initial and max file size settings in SQL and the autogrowth
settings.
Torsten Meringer | http://www.mssccmfaq.de -
Restricting rights to modify only some rows
Hi,
I just discovered HTML DB and played around with it on myhtmldb.com because htmldb.oracle.com is down for some reason.
Is there a way to restrict write access to some rows of a table for each user? For example everybody can see the whole table but you can only add/delete/modify the rows where your id/company name/.. is present in one column.
Cheers
MathiasHi,
I just discovered HTML DB and played around with it
on myhtmldb.com because htmldb.oracle.com is down for
some reason.
Is there a way to restrict write access to some rows
of a table for each user? For example everybody can
see the whole table but you can only
add/delete/modify the rows where your id/company
name/.. is present in one column.
Cheers
Mathias -
Hi
Is there not a standard text element that I can use in SAPScript to pull the invoice rows into the Main window?
Many thanks
GerhardWell if you have copied some standard invoice form then yes. Or if you have copied the standard driver program.
Please give a bit more details what your scenario is and on what you struggle. otherwise there is too much guessing involved which wont really increase answer qualitiy. -
Database resource with multiple rows for a same user
Hi all,
I have a database table I'd like to manage in IDM but this table has more than one row per user (the number of rows being variable (from 1 to n, n being able to change every minute).
Thanks for your advice,
BenI think you need to explore the Scripted JDBC resource.
This will allow you to write beanshell scripts to do the needful on the table row (or rows) relating to a single IDM user. Check out the examples.
GF -
Modifying Internal Table row - The column name is dynamic
Hi,
I need to update the internal table as described below,
Assume that i have 10 columns in my internal table and i need to modifying the column value in row, which is dynamic.
for example, i'm writing it in Subroutine and it has 3 formal parameter
1) Key field value
2) Column name
3) Value of the column
in my subroutine i need to write code to modify the row, which should handle the columns dynamically.
Samples,
7th record i need to modify the 4th column value.
4th record i need to modify the 9th column value.
Please guide me to handle this requirement.write me if i'm not clear.
...NandhaFor the column check the ASSIGN statement:
No system here, but I think it is:
ASSIGN COMPONENT <index> OF STRUCTURE <structure> TO <field-symbol>.
For the row:
READ TABLE <itab> INDEX <index> INTO <work area>.
--> For your 1. example you could write:
READ TABLE <itab> INDEX 7 INTO <work area>.
ASSIGN COMPONENT 4 OF STRUCTURE <work area> TO <field-symbol>.
<field symbol> now points to the 4th column of the 7th row.
Guenther
Maybe you are looking for
-
Looking for Nvidea GeForce 6600 OR Similar Graphics Card for Quad G5 PPC
Hi there! Wishing a Happy New Year to yo'all! Was wondering whether someone might help me out with a minor issue I'm having... I have recently acquired a Quad 2.5GHz PPC G5 (with PCIe). When I bought it, it came installed with a NVIDIA Quadro FX 4500
-
SPEED TEST: 10.0.2 faster than 10.0.3
After a couple of weeks battering my brain switching between two identical systems with one running 10.0.2 and the other 10.0.3, I decided to do a side-by-side comparion. To my (not really) surprise, 10.0.2 was much FASTER and less beachballing than
-
Sync'd files not showing up in Podcasts
Having two issues with podcasts. I am using OSX 10.10 beta and iPhone 6+ 8.0.2 I have many mp3 files that i import into iTunes and then change media type to podcast so that i can use the Podcast app on iPhone to play them with the skip ahead / skip b
-
I have been trying to reinstall the Netflix app onto my ipad but can not find it in the App Store. I have also tried to connect direct from the website but had no luck either. I had deleted the original app as the site was not working properly and it
-
Error while starting agent.
Hi, Config : ODI 11g I have created a standalone agent to run my scenarios. I have set all the required configuration in odiparams.bat file( like Master repository related deatails ,work repository details etc). I am starting that agent by executing