forked from phoedos/pmd
[plsql] Support more than simple names for order by and select into.
This commit is contained in:
@ -1189,9 +1189,9 @@ ASTOrderByClause OrderByClause() :
|
||||
void OrderByEntry() #void :
|
||||
{}
|
||||
{
|
||||
( LOOKAHEAD(2) ColumnAlias() | LOOKAHEAD(2) SqlExpression() )
|
||||
( LOOKAHEAD(ID() ".") SqlExpression() | LOOKAHEAD(2) ColumnAlias() | SqlExpression() )
|
||||
[ <ASC> | <DESC> ]
|
||||
[ LOOKAHEAD(2) <NULLS> "FIRST" | LOOKAHEAD(2) <NULLS> "LAST" ]
|
||||
[ <NULLS> ( "FIRST" | "LAST" ) ]
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1675,10 +1675,14 @@ ASTIntoClause IntoClause() :
|
||||
}
|
||||
|
||||
ASTVariableName VariableName() :
|
||||
{ ASTID id; }
|
||||
{ ASTID id; StringBuilder name = new StringBuilder(); }
|
||||
{
|
||||
id = ID() {jjtThis.setImage(id.getImage());}
|
||||
{ return jjtThis; }
|
||||
id = ID() { name.append(id.getImage()); }
|
||||
[ "." id = ID() { name.append('.').append(id.getImage()); } ]
|
||||
{
|
||||
jjtThis.setImage(name.toString());
|
||||
return jjtThis;
|
||||
}
|
||||
}
|
||||
|
||||
ASTBulkCollectIntoClause BulkCollectIntoClause() :
|
||||
|
@ -61,4 +61,11 @@ public class SelectIntoStatementTest extends AbstractPLSQLParserTst {
|
||||
StandardCharsets.UTF_8);
|
||||
ASTInput input = parsePLSQL(code);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParsingIntoRecordField() throws Exception {
|
||||
String code = IOUtils.toString(this.getClass().getResourceAsStream("SelectIntoStatementRecordField.pls"),
|
||||
StandardCharsets.UTF_8);
|
||||
ASTInput input = parsePLSQL(code);
|
||||
}
|
||||
}
|
||||
|
@ -56,5 +56,9 @@ SELECT department_id "Dept", hire_date "Date", last_name "Name",
|
||||
WHERE hire_date < '01-SEP-2003'
|
||||
ORDER BY "Dept", "Date", "Name";
|
||||
|
||||
SELECT listagg(e.email,',') within group (order by e.email )INTO
|
||||
v_task_resp
|
||||
FROM sso_auth_employees e;
|
||||
|
||||
END;
|
||||
/
|
@ -0,0 +1,13 @@
|
||||
--
|
||||
-- BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
--
|
||||
|
||||
BEGIN
|
||||
|
||||
SELECT the_id
|
||||
INTO my_record.the_id
|
||||
FROM my_table
|
||||
WHERE the_id = '1';
|
||||
|
||||
END;
|
||||
/
|
Reference in New Issue
Block a user