How to view stored procedure spec?
sp_help ${stored_procedure_name}
How to view the source of stored procedure?
sp_helptext ${stored_procedure_name}
Super simple procedure example
DECLARE @ricCode VARCHAR(20)
BEGIN
SELECT @ricCode = '9779.HK'
PRINT @ricCode
END
Simple cursor example—key sqls are highlighted
use DRMS
go --sybase sqls are sparated by go, which database are you using. There is no ; in sybase
CREATE UNIQUE INDEX ExchangeAccountParam_IDX on ExchangeAccountParam ( id, parameter )
go
DECLARE attrCursor CURSOR
FOR SELECT parameter, value FROM ExchangeAccountParam WHERE id = 4 for update
go -–this go could contain nothing else, only this cursor declare
DECLARE @ricCode VARCHAR(20),
@brokerId VARCHAR(20),
@securityId INTEGER
OPEN attrCursor
FETCH attrCursor INTO @ricCode, @brokerId
WHILE (@@sqlstatus = 0)
BEGIN
--Get securityId from ricCode
SELECT @securityId = id FROM ETSalternativeIdentifier WHERE altId = @ricCode
IF @securityId IS NULL
SELECT @ricCode, @brokerId, @securityId, 'NULL securityId--Give up!'
ELSE IF @brokerId = 'HM091'
BEGIN -- if there are several sqls in this block, must be surrounded by BEGIN/END
SELECT @ricCode, @brokerId, @securityId, 'Insert HKG-MM,HM091!'
INSERT INTO QuoterConfigParam VALUES (35, @securityId, @ricCode, 'HKG-MM,HM091')
END
ELSE IF @brokerId = 'HM092'
BEGIN
SELECT @ricCode, @brokerId, @securityId, 'Insert TCMECS,HM092!'
INSERT INTO QuoterConfigParam VALUES (35, @securityId, @ricCode, 'TCMECS,HM092')
END
ELSE IF @brokerId = 'HM093'
BEGIN
SELECT @ricCode, @brokerId, @securityId, 'Insert TCMECS,HM093!'
INSERT INTO QuoterConfigParam VALUES (35, @securityId, @ricCode, 'TCMECS,HM093')
END
FETCH attrCursor INTO @ricCode, @brokerId
END
CLOSE attrCursor
go
DEALLOCATE CURSOR attrCursor
go -- destroy the cursor
for update and for read only
select * from test for update
for update means I am going to change the content of this line, add a lock at it!
select * from test for read only
for read only means I simply need to read the line, no lock is needed.
分享到:
相关推荐
Sampling Procedures and Tables For Life and Reliability Testing MIL-HDBK-108
FX and PC communication program source code and OMRON correspondent with the original procedures and code
#### 存储过程 (Procedures) 存储过程是一种预编译的 SQL 脚本,它可以被多次调用来执行特定任务,如数据处理、事务处理等。在 Sybase IQ 中,存储过程具有以下特点: - **参数化**: 存储过程可以接受输入参数,并...
ANSI IES TM-34-19 Calculation Procedures and Specification Criteria for Lighting Calculations.pdf
在"Module 4 Procedures and Functions_sql_"这个主题中,我们将深入探讨这两者的概念、用法以及如何在实际应用中实施它们。 一、存储过程(Stored Procedures) 1. 定义:存储过程是一组预先定义并编译好的SQL语句...
JEDEC SPP-024A Standard Procedures And Practices - Reflow Flatness Requirements for Ball Grid Array Packages - 完整英文电子版(6页).zip
### 知识点总结 #### 一、设计与基本数据准则 - **焊接结构设计**:本手册提供了焊接结构设计的基本准则与数据。 - **施工方法**:详细介绍了焊接施工的具体方法,包括不同焊接工艺的选择及其适用场景。...
MIL-STD-1235C Single-And Multi-Level Continuous Sampling Procedures And Tables For Inspection By Attributes – 完整英文版(303页).pdf
《MIL-STD-414 Sampling Procedures and Tables for Inspection by Variables》是美国军事标准中的一项重要规定,它为质量控制提供了系统性的抽样检验方法,适用于百分比缺陷的检查。这一标准主要用于确保军事设备、...
4. **Procedures**:Sybase ASE支持的存储过程列表及相关语法说明。 - [http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36273.1572/html/sprocs/title.htm]...
MIL-STD-414 Sampling Procedures And Tables For Inspection By Variables For Percent Defective - 完整英文版(116页).pdf
### 移动与便携设备射频暴露评估程序及设备授权政策 #### 一、概述 本文档旨在明确移动和便携式设备的射频(RF)暴露评估程序、要求以及设备授权政策。该文档取代了之前的版本,并应与其他联邦通信委员会(FCC)...
- **Scalability and Performance**:ASE具有良好的可扩展性和高性能特性,能够支持大规模的数据存储需求。 - **Security Features**:提供了丰富的安全特性,包括用户认证、访问控制、审计功能等,保障数据的安全性...
Oracle Customer Intelligence Concepts and Procedures
If the law has made you a witness, remain a man of science. You have no victim to avenge, no guilty or innocent person to convict or save— you must bear testimony within the limits of science.
美国大学生数学建模竞赛(Mathematical Contest in Modeling,简称MCM)是美国每年举办的一项备受推崇的大学生竞赛。MCM旨在汇集来自不同学科背景的优秀大学生,共同解决现实世界中的数学建模问题。...
在 Sybase 中,存储过程分为两种类型:用户定义的存储过程(User-Defined Stored Procedures)和系统存储过程(System Stored Procedures)。用户定义的存储过程是由开发者创建的,可以根据业务需求进行定制。系统...
标题“DB2 Stored Procedures-Building and Debugging”明确指出了本文档的主题:如何在 IBM DB2 数据库环境中构建(Building)和调试(Debugging)存储过程(Stored Procedures)。这表明文档将围绕 DB2 存储过程的...