Some Questions About SQL Functions - Mailing list pgsql-novice

From Majid Azimi
Subject Some Questions About SQL Functions
Date
Msg-id 4C827C39.6070505@gmail.com
Whole thread Raw
Responses Re: Some Questions About SQL Functions  (Siddharth Saha <siddharthsaha@drishti-soft.com>)
List pgsql-novice
  Hi guys.

I have these questions about SQL functions. some of them are not covered
in documentation:

1. Can a SQL function call another SQL function?
2. How about recursive calls?
3. Consider we have function that has a varchar argument.

     CREATE FUNCTION func(varchar) RETURN void AS $$
         some SQL queries.
     $$ LANGUAGE SQL;

Should we define the argument, varchar or we should define the length
too like varchar(20)? How about return values?
4. consider this example:
we have table named student and a function like this: it only gets a
student row and add that row to the student table.

CREATE FUNCTION add_new(student) RETURNS void AS $$
     INSERT INTO student VALUES ($1);
$$ LANGUAGE SQL;

is this function syntactically right?

Thank you very much.

pgsql-novice by date:

Previous
From: "Turner, John J"
Date:
Subject: Re: Fwd: StackBuilder can't fetch application list?
Next
From: Majid Azimi
Date:
Subject: Raw Device Support