zoukankan      html  css  js  c++  java
  • CUBRID学习笔记 18 sql语句的预处理(类似存储过程)

       定义预处理  类似sqlserver的存储过程

      语法

    PREPARE stmt_name FROM preparable_stmt

    说明
    PREPARE  关键字 
    stmt_name 预处理语句的名字 昵称;)
    FROM   关键字
    preparable_stmt  要预处理的语句
    PREPARE stmt FROM 'SELECT * FROM game WHERE host_year = ?';

    执行预处理

      语法
    EXECUTE stmt_name [USING value [, value] …]
    说明 execute 关键字
    stmt_name 预处理名字
    using 关键字
    value 参数值

    EXECUTE stmt USING 2004;

    欢迎转载 ,转载时请保留作者信息。本文版权归本人所有,如有任何问题,请与我联系wang2650@sohu.com 。 过错


    执行结果


    csql> PREPARE stmt FROM 'SELECT * FROM game WHERE host_year = ?';
    Current transaction has been committed.
    1 command(s) successfully processed.
    csql> EXECUTE stmt USING 2004;
    === <Result of SELECT Command in Line 1> ===
          host_year    event_code    athlete_code     stadium_code    nation_code    medal    game_date
    ========================================================================
          2004         20000         14544            30135           'AUS'          'B'       08/19/2004
    .....
    884 rows selected.
    Current transaction has been committed.
    1 command(s) successfully processed.
    csql>










  • 相关阅读:
    2020.11.6
    2020.7.15小日记
    P1536 村村通
    P1510 精卫填海
    P1020 导弹拦截
    P1164 小A点菜
    5.17练习总结
    P1135 奇怪的电梯
    P1101 单词方阵
    P1443 马的遍历
  • 原文地址:https://www.cnblogs.com/wang2650/p/5284121.html
Copyright © 2011-2022 走看看