CUNY ACE Upskilling: Introduction to Structured Query Language (SF21JOB) — Day 8

We are reaching the end of the course and this means programmability.

    CREATE PROCEDURE quick_example @in_param VARCHAR(50)
      -- passing a value into the procedure using parameter
      -- `@in_param` declared as a VARCHAR(50)
    AS
      BEGIN
      -- beginning of code do something when executing this 
      -- procedure
        DECLARE @out_param VARCHAR(50)
            -- receive value from it has been processed, using 
            -- the same data type (VARCHAR(50))
        SET @out_param = CONCAT (
            '`',
            @in_param,
            '` processed as `',
            UPPER(@in_param),
            '`'
            )
            -- passing a value. the original value processed
        PRINT @out_param
            -- printing the value of the output parameter
      -- end of code to do something when executing this procedure
      END;

Download the class notes for day 8.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.