dml

How to write DB2 DDL & DML audit logs as System Application Logs?

家住魔仙堡 提交于 2019-12-11 15:10:00
问题 I am using DB2 LUW in a windows machine. I want to get the logs for DDL & DML queries used in the database. The default logs(for example S000001.LOG) contains 'null' and not in a readable format. So I enabled auditing and extracted the archived audit logs into .del files. But the audit log extraction creates .del like this: execute.del "2019-09-05-01.19.44.443001","EXECUTE","STATEMENT",13,0,"TEST2","Administrator","ADMINISTRATOR","ADMINISTRATOR",,,"*LOCAL.DB2.190904193137","db2bp.exe",,,,,,,,

Dynamically replacing the value of a node in XML DML

不问归期 提交于 2019-12-10 20:08:24
问题 I am struggling with this now: How do you replace the value of a node in an untyped XML column where the text is equal to a certain variable value? Is it possible? My XML: <attrs> <attr>ManualInsert</attr> <attr>ManualInsert2</attr> <attr>ManualInsert4</attr> <attr>ManualInsert8</attr> </attrs> My Tries: DECLARE @OldValue Varchar(255) = 'ManualInsert' DECLARE @NewValue Varchar(255) = 'ReplacedValue' UPDATE Labels SET Attributes.modify('replace value of (/attrs/attr/text())[1] with if ((/attrs

Is using a SELECT inside a pipelined PL/SQL table function allowed?

别来无恙 提交于 2019-12-08 02:21:34
问题 The docs for pipelined functions say that DML is not allowed when they are used in a SQL statement (typically a SELECT ), and in most examples the pipelined functions are used for data generation or transformation (accepting a custor as parameter), but not issuing any DML statements. Now, technically, it is possible to use SELECTs without any error from Oracle (ORA 14551 will not occur). However, I have experiences reproducible strange behavior of the select; even though PRAGMA AUTONOMOUS

#研发解决方案#iDB-数据库自动化运维平台

血红的双手。 提交于 2019-12-07 03:12:26
郑昀 创建于2015/12/2 最后更新于2015/12/2 关键词:数据库,MySQL,自动化运维,AutoDDL,刷库,帐号授权,审核,回滚 iDB 是刘勤红部门推出的数据库自动化运维平台,它其实已经断断续续开发了几个月了,线上也跑了一段时间, 最近又发布了新版本 。版本迭代的主力是王晓华同学,李世杰也参与了一部分开发工作,曹富志和张永奎是需求方。 iDB 的主要目的是 解决绝大部分重复、复杂的数据库运维工作 ,满足业务对数据库信息查询和快速变更需求 ,借此提升研发效率,保证数据库操作符合审计要求,有可追溯的变更和审核日志。 0x00,数据库自动化运维什么?别人家是怎么玩的? 当数据库越来越多时 ,比如按业务垂直分库了,10个,50个,100个…… 当数据库关系越来越复杂时 ,比如 Cobar 水平拆库,从库分组,级联从库,合并库,比如某些索引要求只建在特定从库上…… DBA 的日常管理,手速再快,也不得不希望有系统来帮忙,毕竟数据库拓扑建立起来后,很多操作都可以自动化完成。 举个例子,工程上线前要开数据库访问帐号和权限。没有平台的话,那就得 DBA 一个一个去建,写库是 M 打头的帐号,读库是 S 打头的帐号,密码强度还得高。有了平台之后,DBA 只需要审核研发人员提的需求即可,系统自动化生成帐号密码,然后发邮件给申请人,或者将密码生成对称加密后的密文展示给申请人。 再比如

hibernate update single column using criteria

雨燕双飞 提交于 2019-12-07 01:40:39
问题 I have a table that contains mamy columns and I want to update the one or few columns of the row without effecting remaining columns I can write query: update table as t set t.a=:a set t.b=:b where t.id=1 But seen I dont know which columns will be selected to update, and I think it is not a good idea to write every query for every scenarios. Well, I have to write query for every scenarios, but I am looking for a better way to update the table dynamically. I am thinking criteria would be a

SQL DML: Incorrect date value (MySQL)

我是研究僧i 提交于 2019-12-06 02:35:08
问题 I created a table in my database: CREATE TABLE official_receipt( student_no INT UNSIGNED, academic_year CHAR(8), trimester ENUM('1', '2', '3'), or_no MEDIUMINT UNSIGNED, issue_date DATE NOT NULL, received_from VARCHAR(255) NOT NULL, amount_of DECIMAL(8,2) NOT NULL, issued_by VARCHAR(255), doc_type ENUM('FULL', 'DOWN', 'INST') NOT NULL, form_of_payment ENUM('CASH', 'INST') NOT NULL, PRIMARY KEY (student_no, academic_year, trimester, or_no) ); I inserted some values: INSERT INTO official

Hive学习总结之三:HiveQL介绍DML

久未见 提交于 2019-12-05 06:36:58
第二部分:DML DML包含如下操作: •向数据表内加载文件 •LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename [PARTITION (partcol1=val1, partcol2=val2 ...)] Load 操作只是单纯的复制/移动操作,将数据文件移动到 Hive 表对应的位置。 filepath 1.相对路径,例如:project/data1 2.绝对路径,例如: /user/hive/project/data1 3.包含模式的完整 URI,例如:hdfs://namenode:9000/user/hive/project/data1 •将查询结果插入到 Hive 表中 基本模式 INSERT OVERWRITE TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...)] select_statement1 FROM from_statement 多插入模式 FROM from_statement INSERT OVERWRITE TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...)] select_statement1 [INSERT

hibernate update single column using criteria

别说谁变了你拦得住时间么 提交于 2019-12-05 04:52:33
I have a table that contains mamy columns and I want to update the one or few columns of the row without effecting remaining columns I can write query: update table as t set t.a=:a set t.b=:b where t.id=1 But seen I dont know which columns will be selected to update, and I think it is not a good idea to write every query for every scenarios. Well, I have to write query for every scenarios, but I am looking for a better way to update the table dynamically. I am thinking criteria would be a good choice. But the problem is that I have no idea how to write criteria update specific column. My code

Combine stored procedure and query in T-SQL

你。 提交于 2019-12-04 16:47:28
问题 How do I combine executing of a stored procedure and using its result or parameters in a regular SQL query? For example I would like to do something like the following: -- passing result of SELECT to SP SELECT a, b FROM t EXEC my_sp a, b -- passing result of SP to INSERT INSERT INTO t EXEC my_sp a, b etc. 回答1: no, you need to use a temp table create table #results (col1 int, col2 varchar(5) ...) INSERT INTO #results EXEC YourProcedure @parma... then you can join to it SELECT * FROM YourTable

SQL Server TOP(1) with distinct

只谈情不闲聊 提交于 2019-12-04 10:45:26
I am trying to extract the first row I get after ordering the result by i_version_id . If I do not use TOP(2) , my query works as expected ans returns all results sorted by i_version_id. But when I add the TOP(2) (as shown below), it says that there is a syntax error near distinct . Please let me know what I am doing wrong. SELECT TOP(2) distinct(i_version_id) FROM [PaymentGateway_2006].[dbo].[merchant] WHERE dt_updated_datetime > '2013-11-11' GROUP BY i_version_id ORDER BY i_version_id; D Stanley If you're only getting the TOP 1 then distinct is irrelevant. It's also irrelevant since grouping