Exemplo n.º 1
0
  public SQLCreateProcedureStatement parseCreateProcedure() {
    SQLCreateProcedureStatement stmt = new SQLCreateProcedureStatement();
    accept(Token.CREATE);
    if (lexer.token() == Token.OR) {
      lexer.nextToken();
      accept(Token.REPLACE);
      stmt.setOrReplace(true);
    }

    accept(Token.PROCEDURE);

    stmt.setName(this.exprParser.name());

    if (lexer.token() == Token.LPAREN) {
      lexer.nextToken();
      parserParameters(stmt.getParameters());
      accept(Token.RPAREN);
    }

    accept(Token.AS);

    SQLBlockStatement block = this.parseBlock();

    stmt.setBlock(block);

    return stmt;
  }
Exemplo n.º 2
0
  public SQLBlockStatement parseBlock() {
    SQLBlockStatement block = new SQLBlockStatement();

    if (lexer.token() == Token.DECLARE) {
      lexer.nextToken();

      parserParameters(block.getParameters());
      for (SQLParameter param : block.getParameters()) {
        param.setParent(block);
      }
    }

    accept(Token.BEGIN);

    parseStatementList(block.getStatementList());

    accept(Token.END);

    return block;
  }