sql-update

Oracle: How to find the timestamp of the last update (any table) within a schema?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-01 08:47:16
问题 There is an Oracle database schema (very small in data, but still about 10-15 tables). It contains a sort of configuration (routing tables). There is an application that have to poll this schema from time to time. Notifications are not to be used. If no data in the schema were updated, the application should use its current in-memory version. If any table had any update, the application should reload all the tables into memory. What would be the most effective way to check the whole schema

SQLiteConstraintException dont go inside catch

风格不统一 提交于 2020-01-01 04:40:06
问题 When I run that code I have inside the db.insert an exception: 08-29 15:40:17.519: E/SQLiteDatabase(3599): android.database.sqlite.SQLiteConstraintException: column date is not unique (code 19) Which is normal, because I already have that value as a key. So in that case I do a catch of SQLiteConstraintException but I never get inside the catch when I run the code. What am I doing wrong? try { db.insert(TABLE_STATISTICS, null, values); } catch (SQLiteConstraintException e) { Log.d("entered",

Update the results of a SELECT statement

江枫思渺然 提交于 2020-01-01 03:19:09
问题 Oracle lets you update the results of a SELECT statement. UPDATE (<SELECT Statement>) SET <column_name> = <value> WHERE <column_name> <condition> <value>; I suppose that this could be used for updating columns in one table based on the value of a matching row in another table. How is this feature called, can it efficiently be used for large updates, does it work when the SELECT joins multiple tables, and if so, how? 回答1: I haven't seen a formal name for this. The Oracle SQL Reference just

SQL Server: update to match and replace only exact words

廉价感情. 提交于 2019-12-31 07:14:18
问题 I want to match an exact word and replace it with another word. Here is the SQL Server query that I am using: UPDATE BODYCONTENT SET BODY = CAST(REPLACE(CAST(BODY AS NVARCHAR(MAX)), 'Test' , 'prod') AS NTEXT) WHERE BODY COLLATE Latin1_General_CI_AS LIKE '%Test%' COLLATE Latin1_General_CI_AS; What this query is doing: 'Test','test','TEST' is updated into 'prod' -- This is expected. 'Test2','TestTest', 'Fastest' is updated into 'prod' - I want to avoid this behavior. Please help. Other queries

SQL Server: update to match and replace only exact words

心已入冬 提交于 2019-12-31 07:14:05
问题 I want to match an exact word and replace it with another word. Here is the SQL Server query that I am using: UPDATE BODYCONTENT SET BODY = CAST(REPLACE(CAST(BODY AS NVARCHAR(MAX)), 'Test' , 'prod') AS NTEXT) WHERE BODY COLLATE Latin1_General_CI_AS LIKE '%Test%' COLLATE Latin1_General_CI_AS; What this query is doing: 'Test','test','TEST' is updated into 'prod' -- This is expected. 'Test2','TestTest', 'Fastest' is updated into 'prod' - I want to avoid this behavior. Please help. Other queries

Oracle - update record and return updated date in same query

二次信任 提交于 2019-12-31 04:48:07
问题 I'm using Java 8 with Spring's JdbcTemplate and Oracle 12.1, I want to update record and get the exact time record was updated jdbcTemplate.update(UPDATE_SQL, null); Currently it returns (int) the number of rows affected, but I want the exact updated date Must I send a new request to get current time which may be inaccurate? More exact will be to save in column updated date, but then to execute another SQL Is there another option to get updated date in one query? Obviously, I don't want to

Access DB Table - Split Field SQL Command

半世苍凉 提交于 2019-12-31 03:59:12
问题 I have an Access 2013 Database Table, dbo_GOV THE GOAL I want to take the USSenators field, which contains data like (below) and split it into USSenator1 and USSenator2 fields, respectively: John Smith;Sarah Levens Bill Burr;Kevin Nill George Thomson;Tracy Johnson THE PROBLEM I've tried a few different Access SQL queries... both (below) when executed, give the error message Invalid use of '.', '!', or '()'. in query expression 'Split(USSenators & ";", ';')(0'. I have verified that there are 0

How to update a table automatically as another table is updated on different mysql server?

余生颓废 提交于 2019-12-31 03:51:06
问题 Let's say I have two databases 'db1' & 'db2' on different mysql servers 'A' & 'B' respectively. I want to check every 6 hours if there is any update found in 'table1' in 'db2', then the 'table1' in 'db1' will be automatically updated. How can I do that with trigger or a cron job? and when it will be fired? 回答1: You could do with with a cron job, simply could run a php file every minute. this file can check for a new row in a table1 in db2 (saving current count of rows in a text file for

Sqlite: multiple update (find and replace) case insensitive

南楼画角 提交于 2019-12-31 02:48:06
问题 I use DB Browser for SQLite to visualize and update an sqlite file. I am able to do run a case sensitive query to update some text like this: UPDATE itemNotes SET note = REPLACE(note , 'sometext', 'abc'); But I would like to match replace all case combinations of sometext (e.g. sometext , SOMEtext , SOmeText ...) I tried to do this : UPDATE itemNotes SET note = REPLACE(LOWER(note), 'sometext', 'abc'); But this transform the whole content of the field note in lower case which isn't what I want

UPDATE Query without WHERE Clause

微笑、不失礼 提交于 2019-12-30 16:28:07
问题 I know it sounds to be a stupid question but i was wondering if the update query can be used without a where clause. And if so in what conditions. Thanks in advance. 回答1: if you don't use the WHERE clause all the records on the table will be affected 来源: https://stackoverflow.com/questions/12163047/update-query-without-where-clause