ALTER Statements
ALTER statements are used to modified a registered table/view/function definition in the Catalog.
ALTER语句用于修改目录中已注册的表/视图/函数定义。
Flink SQL supports the following ALTER statements for now:
Flink SQL目前支持以下ALTER语句:
- ALTER TABLE
- ALTER VIEW
- ALTER DATABASE
- ALTER FUNCTION
Run an ALTER statement
Java
ALTER statements can be executed with the executeSql() method of the TableEnvironment. The executeSql() method returns ‘OK’ for a successful ALTER operation, otherwise will throw an exception.
ALTER语句可以使用TableEnvironment的executeSql()方法执行。executeSql()方法为成功的ALTER操作返回“OK”,否则将引发异常。
The following examples show how to run an ALTER statement in TableEnvironment.
以下示例演示如何在TableEnvironment中运行ALTER语句。
EnvironmentSettings settings = EnvironmentSettings.newInstance()...
TableEnvironment tableEnv = TableEnvironment.create(settings);
// register a table named "Orders"
tableEnv.executeSql("CREATE TABLE Orders (`user` BIGINT, product STRING, amount INT) WITH (...)");
// a string array: ["Orders"]
String[] tables = tableEnv.listTables