power designer使Comment与Name相同.txt
1、先把基本的数据库对象reverse出来; 2、在菜单model->extended model definitions...中,把预定义的powerbuilder加近来; 3、执行菜单功能tools->powerbuilder->reverse extended attributes; 4、在tools->excute commands->edit/run script中书写并执行一下脚本: Dim model Dim tbl Dim ModelTables Set model = ActiveModel Set ModelTables = model.Tables For Each tbl In ModelTables For each col in tbl.columns col.name=col.comment On Error Resume Next next On Error Resume Next NEXT On Error Resume N
sql
SQL> SELECT key,count, DECODE (count, 1, (num+2)/3, 2, (num+1)/3, 3, num/count, num/count) avg FROM test /K COUNT AVG- ---------- ----------a 2 .9b 1 .9c 3 1d 4 1.5if exists(select count1 from bb1 where count1 >=3) begin update bb1 set number = round( number/count1,1) end;else if exists(select count1 from bb1 where count1 =
join
dd[@more@]select t1.aa,case when t1.bb < t2.bb then t2.bb else t1.bb end from table1 t1 left join table2 t2 on t1.aa=t2.aa order by aa; select a.aa ,b.bb from table1 a left join table2 b on a.aa=b.aa order by aa; UPDATE table1 a SET a.bb = (SELECT CASE WHEN t1.bb < t2.bb THEN t2.bb ELSE t1.bb END FROM table1 t1 LEFT JOIN table2 t2 ON t1.aa = t2.aa WHERE t1.aa = a.aa) 今天发现一个严重的问题: table1 AA BB 1 4 2 5 3 6 4 7 table2 1 7 4 6 5 8 有这样的两个表要求当table1中的BB小于table2对应的BB
数据库备份与恢复----第一课
简单概念:来源:与"盐酸"交流总结[@more@]数据库备份与恢复exp rmanexp help=yexp导出:常用exp:逻辑备份 方便rman:物理备份 需要有catalog(9以上可以用ctlfile) ////catalog是恢复目录 ctlfile控制文件rman可以对数据基于时间点,scn时钟进行恢复exp的数据有imp进行恢复rman可以备份和恢复 可以进行增量备份累积/差异 热备份 冷备份一般都是热备份冷备份是指shotdown 之后cprman可以备份spfile,ctlname,datafile ////spfile是server parameter file,9以后才有的新东西 alter system/database set parameter=....进行设置dba:
试一下过程
不要忘记了[@more@]CREATE OR REPLACE PROCEDURE P_ordervsinv(p_year_in CHAR,p_month_in CHAR)IS------------------------------------------------------------------------功能:计算定单与库存满足关系---------$%%$%$--*(&$--------------------------------------------------------------------------p_year CHAR(4) := trim(p_year_in);p_month CHAR(2) := trim(p_month_in);ls_orderdate2 CHAR(8); --a订单日期ls_orderdate8 CHAR(8); --b订单日期li_version2 integer; --a版本号li_version8 integer; --b版本号li_coun
数据库中分组字符串相加
SQL> select * from test;ID MC---------- -------------1 111111 222222 111112 222223 111113 222223 33333已选择7行。SQL> select id,ltrim(max(sys_connect_by_path(mc,',')),',') row2colfrom (select id,mc,id+(row_number() over(order by id)) node_id,row_number() over(partition by id order by id) rnfrom test)start with rn = 1connect by node_id-1 = prior node_idgroup by idorder by id;ID ROW2COL---------- -------------------------------------------------------------1 11111,222222 11111,222223 11111,2
几个分析函数的比较
rownumrank()dense_rank()[@more@]关于partition by 这些都是分析函数,好像时8.0以后才有的 row_number()和rownum差不多,功能更强一点(可以在各个分组内从1开时排序) rank()是跳跃排序,有两个第二名时接下来就是第四名(同样是在各个分组内) dense_rank()l是连续排序,有两个第二名时仍然跟着第三名。相比之下row_number是没有重复值的 lag(arg1,arg2,arg3): arg1是从其他行返回的表达式 arg2是希望检索的当前行分区的偏移量。是一个正的偏移量,时一个往回检索以前的行的数目。 arg3是在arg2表示的数目超出了分组的范围时返回的值
分析函数学习3 ROW_NUMBER
ROW_NUMBER is an analytic function. It assigns a unique number to each row to which it is applied (either each row in the partition or each row returned by the query), in the ordered sequence of rows specified in the order_by_clause, beginning with 1.You cannot use ROW_NUMBER or any other analytic function for expr. That is, you can use other built-in function expressions for expr, but you cannot nest analytic functions.[@more@]ROW_NUMBER() OVER( order_by_clause)query_partition_clauseExampleFo
分析函数学习2 SYS_CONNECT_BY_PATH
SYS_CONNECT_BY_PATH is valid only in hierarchical queries. It returns the path of a column value from root to node, with column values separated by char for each row returned by CONNECT BY condition.Both column and char can be any of the datatypes CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The string returned is of VARCHAR2 datatype and is in the same character set as column.[@more@]The following example returns the path of employee names from employee Kochhar to all employees of Kochhar (and their em
分析函数学习1 level
level is a pseudo column used with CONNECT BY and denotes the node level of the tree structure.[@more@]For example, given the following department/sub-department layering architecture, we have an Accounting department within a Financials department within a Software department, that is,Software OS Financials Spreadsheets AccountingThe existence of a valid "parent" department can be enforced with a foreign key constraint on a department name column. This constraint ensures
一个经典的查询及其SQL语句
查询所有班级中每个部门薪水前5名的员工姓名,应该怎样写查询语句?第一次遇到这个问题还是在JDZ的时候,省支撑的XY(kevin,我校友)提供的答案,非常好很精练。后来在ITPUB上见到有人问同样的问题,也见到一些不错的答案。我知道的方法一共有这么三种:[@more@]是根据 hr 用户下的 employees 写的,实现的功能类似代码:---------------------------------------------------------------------select department_id, last_name, salary, rnfrom (select e.last_name, e.salary, e.department_id, rank() over(partition by e.department_i