返回首页

gbase数据、南大通用产品文档:GBase8a

更新日期:2024年09月11日

SHOW PROCEDURE STATUS
功能说明
显示已经创建成功的存储过程的状态。
语法格式
SHOW PROCEDURE STATUS [WHERE conditions];
表5- 124 参数说明
参数名称


where conditions
过滤条件。
示例
示例1:显示已经创建成功的存储过程的状态。
gbase>
SHOW PROCEDURE STATUS\G
*************************** 1. row ***************************
Vc: vc1
Db: demo
Name: proc_1
Type: PROCEDURE
Definer: root@%
Modified: 2020-07-15 19:25:14
Created: 2020-07-15 19:25:14
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
1 row in set (Elapsed: 00:00:00.00)
示例2:显示vc1 的demo 库下已经创建成功的存储过程的状态。

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1127
gbase>
SHOW PROCEDURE STATUS where vc='vc1' and db='demo'\G
*************************** 1. row ***************************
Vc: vc1
Db: demo
Name: proc_1
Type: PROCEDURE
Definer: root@%
Modified: 2020-07-15 19:25:14
Created: 2020-07-15 19:25:14
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
1 row in set (Elapsed: 00:00:00.00)

本示例实现了使用可更新结果集获取AUTO_INCREMENT 列的值。
示例如下:
package com.gbase.jdbc.simple;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;

GBase 8a 程序员手册JDBC 篇
南大通用数据技术股份有限公司

- 151 -
import java.sql.SQLException;
import java.sql.Statement;

public class SampleUpdatableResultSet {



private
static
final
String
URL
=
"jdbc:gbase://192.168.111.95:5258/test?user=sysdba&password=";



public static void main(String[] args) {


try {



(new SampleUpdatableResultSet()).test();


} catch (Exception ex) {



}

}


public void test() throws Exception {


Connection conn = null;


try {



Class.forName("com.gbase.jdbc.Driver").newInstance();



conn = DriverManager





.getConnection(URL);




Statement stmt = null;



ResultSet rs = null;



try {








stmt = conn.createStatement(






java.sql.ResultSet.TYPE_FORWARD_ONLY,






java.sql.ResultSet.CONCUR_UPDATABLE);









// 创建表




stmt.executeUpdate("DROP
TABLE
IF
EXISTS

GBase 8a 程序员手册JDBC 篇


- 152 -

南大通用数据技术股份有限公司
autoIncTutorial");




stmt.executeUpdate("CREATE TABLE autoIncTutorial ("






+ "priKey INT NOT NULL AUTO_INCREMENT, "






+
"dataField
VARCHAR(64),
PRIMARY
KEY
(priKey))");









// 获取自增一字段值




rs = stmt.executeQuery("SELECT priKey, dataField "






+ "FROM autoIncTutorial");




rs.moveToInsertRow();




rs.updateString("dataField", "AUTO INCREMENT here?");




rs.insertRow();












rs.last();











int autoIncKeyFromRS = rs.getInt("priKey");




rs.close();




rs = null;




System.out.println("Key returned for inserted row: "






+ autoIncKeyFromRS);



} finally {




if (rs != null) {





try {






rs.close();





} catch (SQLException ex) {












}




}




if (stmt != null) {





try {






stmt.close();





} catch (SQLException ex) {

GBase 8a 程序员手册JDBC 篇
南大通用数据技术股份有限公司

- 153 -












}




}



}


} catch (SQLException ex) {



// 处理错误



System.out.println("SQLException: " + ex.getMessage());



System.out.println("SQLState: " + ex.getSQLState());



System.out.println("VendorError: " + ex.getErrorCode());


} finally {



conn.close();


}

}
}

要使用导出结果集功能,您可以在结果集窗口中选择要导出的行内容点击
右键,选择右键菜单中“导出结果集”
。目前支持的结果集格式有:XML、JSON、
HTML、CSV 四种格式,如下图所示:

GBaseDataStudio 管理工具手册
- 366 -
南大通用数据技术股份有限公司
图6- 12 导出结果集内容菜单
图6- 13 导出结果集类型

GBaseDataStudio 管理工具手册
南大通用数据技术股份有限公司
- 367 -