Query and update a table/view
What is the best & fastest way to do this?
1) Put up a query input region for users to enter parameters.
2) Run a query on a table/view using those parameters.
3) Allow the output in (2) to be modified by user (multiple rows at a time) and then Submit the updates back to update th table/view
I can do (1) and (2) easily. How can I do (3)?
Thanks
Make a report on the table. Go to the definition of
the report column and change the "Display As" type to
text field or select list or whcih ever is
applicable. Write a process on submit to insert these
values back to the table. You will have control over
which columns the user can modify.Thats a good idea and I was able to start on it. But how can my after submit process tell which rows to modify? i.e. what will my after submit process look like?
for rec in (....)
loop
update my_table set
end loop;
Help? Thanks
Similar Messages
-
Analysing and Updating a table
Hi,
Can anyone help me on follwing query..
Can analyse of a table and updation on to same table can happen paralley?
thank in advance.What's your db version? The very first thing is that you should not use the analyze command but dbms_stats package. Now , I am not sure why you want to gather the stats and update the table at the same time? As mentioned by Erica, the update should be followed with the stats gathering. And about the index usage, there are couple of things that can stop index from being used, for example, low selectivity on the column can very well stop the index. Other than that, if you are accessing the column containing the index alone and the column is supposed to contain the null values, oracle would rather use a FTS than using the index which actually makes perfect sense since use of index would result in incorrect data. So there can be couple of htings possible which may stop your index from being used. All what dbms_stats(and even Analyze) command would do , is to make the distribution of the data known tooracle. Having stats alone doesn't guarantee that the index would be used for sure.
HTH
Aman.... -
How To Update A Table View From Client Side !!!!
Hi I would like to update a table view from the Client Side. So that the user can keep updating the relevent data on the client and when they have finally finished they can press Save so the entire page is then sent to the Server.
Does anyone know how to do this, I guess u have to use the EPCM, I have just started on it and would really appreciate some Help.
Thanks,
Emmanuel.This is what I found :-
There are a couple of ways to approach this.
1) load the excel spreadsheet into the database "as is". You can use interMedia
text to convert the .xls file into a .htm file (HTML) or use iFS (see
http://technet.oracle.com/
for
more info on that) to parse it as well. InterMedia text will convert your XLS
spreadsheet into a big HTML table (easy to parse out what you need at that
point)
2) Using OLE automation, a program you write can interact with Excel, request
data from a spreadsheet, and insert it. Oracle Forms is capable of doing this
for example as is other languages environments. In this fashion, you can remove
the "manual" and "sqlldr" parts -- your program can automatically insert the
data.
3) You can write a VB script that uses ODBC or Oracle Objects for OLE (OO4O) in
Excel. This VB script would be able to put selected data from the spreadsheet
into the database. We would recommend OO4O. It provides an In-Process COM
Automation Server that provides a set of COM Automation interfaces/objects for
connecting to Oracle database servers, executing queries and managing the
results. OO4O is available from
http://technet.oracle.com -
ORA-20001: Unable to create query and update page.
I am using the wizard: Form on a table with report 2 pages. I do not change any of the values when using the wizard (just taking all default values)
I created over 10 pages successfully already.
When creating the one page, I received this error on clicking the 'Finish' button
Error creating query and update.
Return to Application
ORA-20001: Unable to create query and update page. ORA-12899: value too large for column "FLOWS_010500"."WWV_FLOW_PAGE_PLUGS"."PLUG_QUERY_COL_ALLIGNMENTS" (actual: 269, maximum: 255)
Seems like it might be table related since I can continue and create more forms/reports on other tables.
Any help would be appreciated.336554,
Looks like there is a 127-column limit on the number of report columns supported when using that wizard. Do you have more than that?
57434 -
How to call a idoc in abap program and updates catsdb table
how to call a idoc in abap program and updates catsdb table
thank you,
Jagrut BharatKumar ShuklaHi Kishan,
You can refer to following help document,
http://help.sap.com/saphelp_nw04/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/content.htm
Regards,
Meera -
Check two columns and update other table
HI ,
I have a table called trackCenterline .Below is the table.
What i want to do is If the segmentSequenceID is 1 it should pick the corresponding SegmentID i.e 10001 and Check for the same segment id in other table called TrackSegment which is below. and pick the BeginMilepost of that segmentID and Update That
Milepost in a new table .At end SegmentSequenceID number it should pick ENDMilepost and update
TrackCenterline table.
TrackSegment table
In the below table for 10001 SegmentID it should pick BeginMilepost. For end Number of SegmentSequenceID in above table ID ends at 121 for that end sequenceID It should refer TrackSegment table below and pick EndMilepost and should be updated in another
table Milepost column.
after that a new segment starts with new sequence .and so on ...
bhavanaHi Deepa_Deepu,
According to your description, since the issue regards T-SQL. I will help you move the question in the T-SQL forums at
http://social.technet.microsoft.com/Forums/en-US/home?forum=transactsql. It is appropriate and more experts will assist you.
When you want to check two columns from two tables then return some results and update the third table. I recommend you use join function and combine two tables, then use update select from statement for modifying the Mailpost table. You can refer to the
following T-SQL Statement.
-----using join to connect to two tables
select TrackCenterline.FeatureId,TrackCenterline.SegmentId,
TrackCenterline.SegmentSequenceId,TrackSegment.BeginMilepost,TrackSegment.EndMilepost
from dbo.TrackCenterline join dbo.TrackSegment
on TrackCenterline.SegmentId=TrackSegment.SegmentId
order by TrackCenterline.SegmentId, TrackCenterline.SegmentSequenceId
---the result shows as following.
FeatureId SegmentId SegmentSequenceId BeginMilepost EndMilepost
AMK100011 10001 1 61.0000 61.3740
AMK100012 10001 2 61.0000 61.3740
AMK100013 10001 3 61.0000 61.3740
AMK1000121 10001 121 61.0000 61.3740
AMK100021 10002 1 61.1260 61.7240
AMK100023 10002 3 61.1260 61.7240
AMK100033 10003 3 61.3740 62.9530
-----Then you can use update select from statement to modify the Mailpost table, Or you can post the table structure of Mailpost
And for more information, you can review the following article about update statement.
http://www.techonthenet.com/sql/update.php
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
Comparing Two tables with 300k records and update one table
Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
Column B has same data in both the tables.
I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
I m trying to do using PLSQL Tables.
Any suggestion?
Thanks.Hi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
Always say which version of Oracle you're using (for example, 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
ef2019c7-080c-4475-9cf4-2cf1b1057a41 wrote:
Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
Column B has same data in both the tables.
I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
I m trying to do using PLSQL Tables.
Any suggestion?
Thanks.
Why are you trying to use PL/SQL tables? If tabl_1 and tabl_2 are regular database tables, it will be much simpler and faster just to use them.
Depending on your requirements, you can do an UPDATE or MERGE, either in SQL or in PL/SQL. -
Select from table and Update to a view
Hi,
Can anybody let me if this is possible.
I have a Master(single record)/detail(multi record) form. I would want to query/select the details from the base table but when I update/delete I would want to update/delete the details to a view.
Is this doable?
Thanks
KAvithaHi Kavitha,
Solution 1 :-
Why cann't you trap the ON-TRIGGERS (like ON-INSERT /On-update/ON-DELETE) of that block and put your piece of code to update/delete the view.
SOlution 2 (I didn't try this ,so please try)
I am not sure whether it will help you but can try !!Sorry if not working and let me know if you have a solution
Create a package with Insert /Update/Delete sub procedures which does DML on view (as per ur requirement).
Call this Procedure on DML Target Name of Advanced Database .
Regards -
How to Query and Update/Insert Large Tables ...
I have the following 2 tables:
Table 1: Pricing
This table holds pricing details of all Items (roughly 150,000 items). One Item has three types of prices Standard, Promotion, and Discounted. Therefore the table contains roughly 150,000 * 3 records. Also the prices may get updated frequently every day.
Item#---Type------------FromDate---ToDate-----Price
===================================
AAA-----Standard------01/01/05---31/12/05---1.50
AAA-----Promotion----16/12/05---20/12/05---1.40
AAA-----Discounted---10/12/05---15/12/05---1.20
BBB-----Standard------01/01/05---31/12/05---1.60
BBB-----Promotion----17/12/05---18/12/05---1.30
BBB-----Discounted---10/12/05---15/12/05---1.50
Table 2: BestPrice
At a given date, this table contains the best price (lowest price) of each item for the following 21 days (including the current date). The POS system is accessing this table to get the daily best price for billing customers.
Item#----Date--------BestPrice
=====================
AAA------17/12/05----1.40
AAA------18/12/05----1.40
AAA------19/12/05----1.40
AAA------20/12/05----1.40
AAA------21/12/05----1.50
BBB------17/12/05----1.30
BBB------18/12/05----1.30
BBB------19/12/05----1.60
BBB------20/12/05----1.60
BBB------21/12/05----1.60
Problem Statement:
Table 2 (BestPrice) needs to get updated from Table 1 (Pricing) at least once every day with the best price for each item for the next 21 days (including the current day). Whats the most efficient method to perform this job?I don't know really why your application needs to use BestPrice table!
It is not clear what it does for it because querying will not be better than querying the pricing table. This will be very fast with an index on intem#
On the other hand, why do you use three rows per item in Pricing table? it could be one row per item.
Any way, to populate the table for the first time :
insert into bestprice
select item#
, dte
, min(price) bestprice
from pricing, (select trunc(sysdate) + rownum - 1 dte from dual connect by rownum <= 21) t
where dte between fromdate and todate
group by dte, item#Now, you can have a row trigger (update) on Pricing table which can change BestPrice table according to a change in Pricing tabe.
Then you have to use a daily job that can be based on the following statement:
update BestPrice B
set dte = trunc(sysdate) + 20
, BestPrice =
select min(price)
from Pricing P
where P.item# = B.item#
and B.dte between P.FromDate and P.ToDate
where dte = trunc (sysdate) - 1Message was edited by:
Michel SALAIS
I forgot to say that that if your periods in the pricing table don't covere a desired date in the BestPrice table then my insert statement will not treat it and my update will put it to NULL -
Update a table view field calling a service
Hi all,
is there a way in a table view to calculate the value of a field calling a data service, using as calling arguments other fields from the same row?
For example I have line items of a sales order in a table view. In one field the user enters the quantity in the desired unit of measure. I would like to have the quantity transformed in KGs in the same row.
Is this possible?
Points will be awarded for usefull suggestions.
Regards,
PanosMake a report on the table. Go to the definition of
the report column and change the "Display As" type to
text field or select list or whcih ever is
applicable. Write a process on submit to insert these
values back to the table. You will have control over
which columns the user can modify.Thats a good idea and I was able to start on it. But how can my after submit process tell which rows to modify? i.e. what will my after submit process look like?
for rec in (....)
loop
update my_table set
end loop;
Help? Thanks -
Compare 45 columns and update one table col
I am using Oracle 9i database.I need to compare each record between two tables
and update the one of table column (what records are updated)
CURSOR cur1 is select t1., t2. from t1, t2 where t1.primarykey = t2.primarykey
FOR rec1 IN cur1
LOOP
IF rec1.t1_col_1<>rec1.t2_col_1
then
update t1
set col_t1.rem="MOdified",t.col_1=rec1.t2_col_1
where t1.primerykey=rec1.primarykey
END IF;
IF rec1.t1_col_2<>rec1.t2_col_2
then
update t1
set col_t1.rem="MOdified",t.col_2=rec1.t2_col_2
where t1.primerykey=rec1.primarykey
END IF;
..........45 if else conditions
END LOOP;
I have 1 million records to compare and 45 columns to compare, how do I increase performance.
Currently it takes about 5hrs for the cursor to go through this if -else comparison.
Thanks and Regards
Swayamprakash.ChiluveruHi Swayamprakash,
Few basics first.
1. DML SQL's perform better than PL/SQL. Sounds great but Oracle then need to hop between SQL and PL/SQL engine for every record in the cursor causing THRASHING. This is an old concept, reference of which can be found in Operating Systems.
With Bulk Collect option, this could be minimized to a large extent, but causes a large amount of Undo being generated. This is another pitfall of using Bulk Collect. Morever, when you expect more percentage of records to be updated, it is advisable that the indices (if any) must be disabled. They can be rebuild afterwards causing very minimal amount of Undo. Performance gain is expected here.
Now a query that you need to clarify:
1. One million records to be updated on a diurnal basis - An OLTP database might need this functionality which is better handled by a screen driven interface rather than a SQL/Procedure running in background.
An OLAP database must simply ignore such requirements for they are meant to be history archives.
Suggestion:
Merge - Seems to be the only optimal solution at the moment for the exact requirements are unclear. Already, somone has suggested this.
Oracle Developers, DBA's must setp out from technicalities and turn towards functionality.
Kind regards,
Abhijit -
Memory leak/overload when looping by index over a large query and updating each DB record
I am importing a CSV file into a temporary table and then running a select query that joins my actual database table with the temporary table, looking for any changes in the data. If changes exist, the select query is looped from 1 to #recordCount# and an update is applied to each record via cfquery. It runs very quickly (much more quickly than looping the query itself), but my memory spikes and overloads after about 1500 updates are completed. I need to be able to do upwards of 20000 at a time, without killing my system. I have tried manually setting the runtime garbage collection to trigger after X number of loops, but that doesn't seem to help. I am running CF8. See below for loop example:
<cfloop from="1" to="#updatedRecordsQuery.recordCount#" index="a">
<cftry>
<cfquery datasource="#db#" name="doUpdate">
UPDATE
CI
SET
firstname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.firstname[a]#" />,
lastname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.lastname[a]#" />,
etc, for about 15 various fields
FROM
client_info CI
WHERE
CI.client_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#updatedRecordsQuery.client_id[a]#" />
</cfquery>
<cfcatch type="database">
<cfset local.updateErrorList = listappend(local.updateErrorList,updatedRecordsQuery.client_id[a]) />
<cfset local.error = true />
</cfcatch>
</cftry>
</cfloop>I would suggest to use select update instead of looping over query object and update each row one-by-one.
Procedure:
- Insert your CSV data into temp table.
- Use a select update SQL query to update the changed data instead of looping over a select query.
Example:
UPDATE
Table
SET
Table.col1 = other_table.col1,
Table.col2 = other_table.col2
FROM
Table
INNER JOIN
other_table
ON
Table.id = other_table.id
NOTE: You can put all your scripts in a Procedure. -
Listening to change in a row of a table a and update a table in a diferent Database
i want to update a table using values from a different database table. how to i do it in SQl 2012
i want to update a table using values from a different database table. how to i do it in SQl 2012
With Service Broker?
Without Service Broker, you would do:
UPDATE targettbl
SET col1 = b.col1,
col2 = b.col2,
FROM targettbl a
JOIN srctbl b ON a.keycol1 = b.keycol1
AND a.keycol2 = b.keycol2
It is important that a row in targettbl maps to at most at one row in srctbl, or else the result will not be predictable.
Erland Sommarskog, SQL Server MVP, [email protected] -
Browse and update database tables
I'm looking for a tool that will let me connect to an Oracle database, select a table and some fields off the table and build a simple java class to navigate / update the data.
Essentially, I'm looking for a tool that replicates the way Microsoft Access can build a form for navigation and update of a database table.
However, I want to use java, not MS Access.
Any ideas if such a tool is available ?
Thankshttp://squirrel-sql.sourceforge.net/
-
Edit Problem after changing and transporting a table view
Hallo Experts,
I hope you can help me.
I changed a Z-table in the Data Dictionary. For this table there exists an Tableview.
After I added three new fields I generate a new tableview:
Utilities -> table maintenance generator
Change -> create maintenance screen -> ok
after this I optimized the layout of the screen.
On our Enviromentsystem my Tableview works perfect.
I can make changes in the table.
Then I transported the new tableview to our testsystem.
There I started the sm30 "Maintain table view" and tried to change table entries.
After a click on "Maintain" the following Message appears:
TK 730 Changes to Repository or cross-client Customizing are not permitted.
The strangest thing is, that before my transport, it worked, I could change table entries.
There were no changes on the userrights.
And I can change a similar table on the testsystem.
I compared the properties of both tables. But I could not find a difference.
Have anybody an idea where the error can be?Hi
Caution: The table is cross-client
Message no. TB113
Diagnosis
You are in the process of maintaining a cross-client table. You are using the standard table maintenance screen here, which is frequently used to maintain client-specific Customizing entries. This message serves to warn you that each change you make will have an effect on all other clients in the system.
System response
You have the authorization required for cross-client maintenance.
Procedure
Think carefully about the effect of your changes. Due to logical dependencies between client-specific Customizing and applications data on the one hand and cross-client Customizing data on the other hand, changing or deleting cross-client data could result in inconsistencies.
Therefore such changes should be carefully planned and coordinated, taking all the clients in the system into consideration.
Maybe you are looking for
-
After BIOS update failure and rollback, audio hot keys detect press but do not function
All other hot keys appear to function properly, only the mute/audio-/audio+ hot keys do not work. I can press the key and the vertical volume indicator displays but it does not move. At this time, I suspect this has to do with the failed BIOS update
-
How do i remove blackberry from Login items in lion?
any idea? I'm trying to remove blackberry device manager from login item but the its checked and greyed out.
-
How can i load a item purchased to a new device
i purchased apps for my ipad they show as a purchase in my itunes history but i can not load them on my ipad2. how do i do that?
-
Can I restore an iPhone backup from a Mac in a Windows PC?
I have copied the files from Library/Application Support/MobileSync/Backup from my Mac to a USB stick and I have to use these backup files on a Windows PC. Will these files from an iTunes for Mac work on an iTunes for Windows? Thanks, Rafael
-
Light box Edge Animate 2014.1.1
I'm not very well versed in the code please give the finished work proet version Edge Animate 2014.1.1. I need to open photos in the ie light box