What are the difference between a function and a stored procedure?

Mahesh Dahale

Mahesh Dahale

@mahesh-E2tZ3t Oct 26, 2024
1) Functions can be used in a select statement where as procedures cannot
2) Procedure takes both input and output parameters but Functions takes only input parameters

Give some more

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Saandeep Sreerambatla

    Saandeep Sreerambatla

    @saandeep-sreerambatla-hWHU1M Oct 28, 2009

    I have a question here..

    Which programming language you are talking about?

    I am not sure this is true for everything ? Correct me If i am wrong 😀
  • Mahesh Dahale

    Mahesh Dahale

    @mahesh-E2tZ3t Oct 28, 2009

    English-Scared
    I have a question here..

    Which programming language you are talking about?

    I am not sure this is true for everything ? Correct me If i am wrong 😀
    sorry for that ES

    talking about SQL function and a stored procedure
    I am preparing for Oracle certification 😎
  • Saandeep Sreerambatla

    Saandeep Sreerambatla

    @saandeep-sreerambatla-hWHU1M Oct 28, 2009

    mahesh_dahale
    sorry for that ES

    talking about SQL function and a stored procedure
    I am preparing for Oracle certification 😎

    Thanks for the information dude.

    I dont know anything about SQL, but I can learn from this thread.

    Please keep this thread alive.
  • sookie

    sookie

    @sookie-T06sFW Oct 31, 2009

    Functions must return a value back to the caller. They don't have any OUT parameter but have RETURN value.

    Stored Procedures can return multiple values to the caller by use of OUT parameters.
  • Mahesh Dahale

    Mahesh Dahale

    @mahesh-E2tZ3t Oct 31, 2009

    Thanks ES and Sookie

    Now
    What is the difference between a CONSTRAINT AND RULE?
  • specialdb

    specialdb

    @specialdb-XFF99c Nov 5, 2009

    1. Functions are compiled and executed at run time.
    Stored procedures are stored in parsed and compiled format in the database.

    2. Functions cannot affect the state of the database which means we cannot perform insert,delete,update and create operations on the database.
    Stored Procedures can affect the state of the database by using insert,delete,update and create operations.

    3 Functions are basically used to compute values. We passes some parameters to functions as input and then it performs some operations on the parameter and return output.
    Stored procedures are basically used to process the task.