Question

Create a function called ami1() that queries and displays the contents of the artist table

Ï postgres.localhost Chinook System Schemas 1 I public 1 Tables (11) 3 album artist 1 Columns (2) 99 artistid integer 8 name

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/*drop table if already created */

drop table artist;

Create New

create table artist(artistID number(5) primary key,name varchar(20));
desc artist;
insert into artist values(101,'Viral');
insert into artist values(102,'Rajgor');
insert into artist values(103,'Poonam');
insert into artist values(104,'Navin');
Select * from artist;
Run SOL Command Line SQL> creale Lable arlislar LisLID number (5) primary key,niame varchar(20)); Table created. SQL> desc ar

Function

CREATE OR REPLACE FUNCTION amit1 RETURN BOOLEAN
IS
BEGIN
dbms_output.put_line('||Artist||Name||');
dbms_output.put_line('_________________');
FOR v_rec IN (SELECT artistID, name FROM artist) LOOP   
dbms_output.put_line('||'||v_rec.artistID || '||' || v_rec.name||'||');
END LOOP;
RETURN TRUE;
END;

Run SQL Command Line Procedure dropped. SQL> CREATE OR REPLACE FUNCTION amit1 RETURN BOOLEAN 2 IS 3 BEGIN 4 dbms_output.put_l

Calling Code

DECLARE
answer BOOLEAN;
BEGIN
answer := amit2();
END;

/

Run SOL Command Line SQL> DECLARE 2 answer ROOI FAN; 3 BEGIN 4 answer := amit2(); 5 END; || Artist||Nane|| ||181||Viral 11102

if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........

Add a comment
Know the answer?
Add Answer to:
Create a function called ami1() that queries and displays the contents of the artist table Ï...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write an SQL query against the Chinook Database v1.4. Each query must run successfully using DB...

    Write an SQL query against the Chinook Database v1.4. Each query must run successfully using DB Browser for SQLite. Create the exact query below. Must use sub query. I saw that a similar solution for this question used IF and CONCAT functions which do not work and return errors. If it is possible to use the CASE function in place of IF that would be greatly appreciated. Also I really hate to ask but if it could be organized neatly...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT