exam questions

Exam 1z0-144 All Questions

View all questions & answers for the 1z0-144 exam

Exam 1z0-144 topic 1 question 104 discussion

Actual exam question from Oracle's 1z0-144
Question #: 104
Topic #: 1
[All 1z0-144 Questions]

View the Exhibit and examine the partial data in the PRODUCTS table.
PROD_ID is the primary key.

Examine the following code:

What is the outcome on execution of the above code?

  • A. It executes successfully.
  • B. It gives an error because the DECODE function can be used only in a SQL statement.
  • C. It gives an error because the SUBSTR and INSTR functions can be used only in a SQL statement.
  • D. It gives an error because both the MAX and DECODE functions can be used only in a SQL statement.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
okl
Highly Voted 5 years ago
The right answer would be B. It gives an error because the DECODE function can be used only in a SQL statement.
upvoted 7 times
CosminCof
4 years, 11 months ago
you can use every sql function in pl/sql block so I think A is good.
upvoted 1 times
Pacogas
4 years, 9 months ago
Answer B is the right answer. Not all the functions are allowed in a pl/sql block. In this case for decode you will get the error ORA-06550: line 4, column 10: PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only
upvoted 5 times
...
...
...
trex_fcs
Most Recent 1 year, 10 months ago
Selected Answer: B
create table products (prod_id number, prod_name varchar2(200), prod_list_price number(10,2) ) edit products declare v_prod_name varchar2(50); v_price number; v_max_price number; v_compare varchar2(40) := NULL; begin select prod_name, prod_list_price into v_prod_name, v_price from products where prod_id =128; select max(prod_list_price) into v_max_price from products; v_prod_name := substr(v_prod_name, 1, instr(v_prod_name,'')); v_compare := decode(v_price, v_max_price, 'Product has the highest place', 'Product does not have the highest priced'); DBMS_OUTPUT.PUT_LINE ('PRODUCT NAME' || v_prod_name || ' Remark ' || v_compare); end;
upvoted 1 times
...
Paps23
2 years, 3 months ago
you can use DECODE and GROUP FUNCTION in SQL statements inside PL/SQL not in procedurals statements. After testing: "Rapport d'erreur - ORA-06550: Ligne 13, colonne 18 : PLS-00204: fonction ou pseudo-colonne 'DECODE' peut être utilisée uniquem. ds instruc. SQL ORA-06550: Ligne 13, colonne 5 : PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:" so B is the correct answer
upvoted 1 times
...
Limak665
3 years, 8 months ago
B is correct. You can use 'DECODE' in PL/SQL block only if it's part of SELECT statement
upvoted 1 times
...
NonaPeach
4 years, 5 months ago
B is correct. https://docs.oracle.com/cd/B28359_01/appdev.111/b28370/fundamentals.htm#LNPLS00212
upvoted 3 times
...
chaoyuim
4 years, 9 months ago
B is the right one.
upvoted 3 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago