我在schema和下图中创建了一个名为categoryname的表,我只创建了一个条目,如下所示
下面的过程是用javascript中的snowflake编写的,但是当我运行这个过程并调用sp_automatic_type2(f58139)时,它在标题中给了我一个错误
CREATE OR REPLACE PROCEDURE sp_automate_type2 (TABLE_NAME VARCHAR)
RETURNS VARIANT NOT NULL
LANGUAGE JAVASCRIPT
AS
$$
var command = "select CATEGORY FROM STORE_PROFILE_LANDING.LANDING.CATEGORYName// cat WHERE
cat.TABLE_NAMES=" + TABLE_NAME;
var results1 = snowflake.execute({sqlText: command});
var category = ""
while (results1.next()){
category = category + results1.getColumnValue('CATEGORY')
}
$$
我想上面的代码将表名标识为'type2'并通过下面的部分过程,可以做什么??
if (CATEGORY=='TYPE 2' or CATEGORY='type 2'){
// finds the primary keys of the given input table and stores it in an array.
var command = "describe table landing." + TABLE_NAME;
var result = snowflake.execute({sqlText: command});
var primary_keys = [];
while (result.next()){
if (result.getColumnValue('primary key')=='Y'){
primary_keys.push(result.getColumnValue('name'));
}
else{
continue;
}
}
暂无答案!
目前还没有任何答案,快来回答吧!