17 April 2016

CST363 Week 7

This week we covered sequences (such as used as primary key), alias (temporary name for table or column), text processing (such as concatenation, lower, upper, initcap, ltrim, rtrim, lpad, rpad and substr) and date & time (to_char and sysdate).

For the assignment we built on last weeks lookup script:

set echo off
set verify off
set heading off
set feedback off
accept OtterIDT prompt 'Please enter the OtterID:';
prompt 'Thank you!';
SELECT 'Student OtterID: ', substr(OtterID, 0, 3) || '-' || substr(OtterID, 3, 2) || '-' || substr(OtterID, 5, 4) FROM student WHERE OtterID='&OtterIDT';
SELECT 'Name: ', upper(Name) FROM student WHERE OtterID='&OtterIDT';

No comments: