exam questions

Exam SnowPro Advanced Data Engineer All Questions

View all questions & answers for the SnowPro Advanced Data Engineer exam

Exam SnowPro Advanced Data Engineer topic 1 question 66 discussion

Actual exam question from Snowflake's SnowPro Advanced Data Engineer
Question #: 66
Topic #: 1
[All SnowPro Advanced Data Engineer Questions]

The following stored procedure has been created to load orders for a single date into a target table:

create or replace procedure uspLoadOrdersByDate ()
returns string
language javascript
execute as owner
as
'
sqlCmd = `INSERT INTO ORDERS_BY_DATE_TGT SELECT * FROM ORDERS_BY_DATE WHERE O_ORDERDATE = $dateToProcess`; sqlStmt = snowflake.createStatement({sqlText: sqlCmd}); res = sqlStmt.execute(); res.next(); return res.GetColumnValue(1);
';

Upon executing the following statements, the following error is returned:

set dateToProcess = '2020-08-02';
call uspLoadOrdersByDate();

Execution error in store procedure USPLOADORDERSBYDATE: Use of session variable '$DATETOPROCESS' is not allowed in owners rights stored procedure At Statement.execute, line 4 position 14

Making what changes will allow the procedure to execute successfully? (Choose two.)

  • A. Change the procedure to EXECUTE AS CALLER.
  • B. Create a scheduled task to execute the procedure each day, and set dateToProcess = CURRENT_DATE() as a session parameter at the task level.
  • C. Modify the body of the procedure to cast $dateToProcess to DATE within the WHERE clause of the INSERT statement.
  • D. Change the procedure to accept $dateToProcess as an input parameter so that no session variables are used within the procedure itself.
  • E. Rename the session variable to upper case to allow the procedure to read from it.
Show Suggested Answer Hide Answer
Suggested Answer: AD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
e970753
1 day, 17 hours ago
Selected Answer: AD
https://docs.snowflake.com/en/en/developer-guide/stored-procedure/stored-procedures-javascript?
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...