在更新查询中运行density_rank()窗口函数-Oracle

时间:2019-06-02 20:01:37

标签: sql oracle

我有以下查询:

SELECT t.*, 
  DENSE_RANK() OVER(PARTITION BY u_a_id, column_name ORDER BY line_num, e_id) AS new_seq_id
FROM tab t;

我在my_seq中有new_seq_id列,我需要对其进行更新。 Oracle中是否可以在更新查询中使用以上方法?

1 个答案:

答案 0 :(得分:1)

您可以使用set path=C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;%path% sqlcmd -U sa -P texas#2019 -i CreateDB.sql

GO
CREATE DATABASE TEX
ON
( NAME = TEX_Data,
  FILENAME = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\TEX_Data.MDF',
  SIZE = 500,
  MAXSIZE = 500, 
  FILEGROWTH = 0 )
LOG ON
( NAME = TEX_Log,
  FILENAME = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\TEX_Log.LDF',
  SIZE = 250,
  MAXSIZE = 250, 
  FILEGROWTH = 0 )
GO
USE TEX
GO
CREATE LOGIN texas WITH PASSWORD = 'texas',CHECK_POLICY = OFF
GO
USE TEX
GO
sp_adduser 'texas'
GRANT 
 BACKUP DATABASE,
 BACKUP LOG,
 CREATE DEFAULT,
 CREATE FUNCTION,
 CREATE PROCEDURE,
 CREATE RULE,
 CREATE TABLE,
 CREATE VIEW 
 TO iris; 
ALTER DATABASE TKO SET RECOVERY SIMPLE
GO