Welcome ...        
          
  ... Visiting Newsgroup Users!
 
  See "What makes SQLA different from the newsgroups?" in the FAQ.
 
vote up 4 vote down
star
1

I'd like to see records added to the stored procedure language of SQA. One of the biggest complaints from my developers when moving code from Oracle to SQLA is the lack of records. With Oracle you can create records in two ways:

  • By Type

    TYPE rec_t IS RECORD
    (
    memvar1 VARCHAR2(30),
    memvar2 VARCHAR2(30)
    );

    rec1 rec_t;
    rec2 rec_t;

  • By Table Row Type

    rec1 TABLE%ROWTYPE;
    rec2 TABLE%ROWTYPE;

  • By Cursor Row Type

    CURSUR curSample IS
    SELECT col1,
    coll2
    FROM TABLE;

    rec1 curSample%ROWTYPE;
    rec2 curSample%ROWTYPE;

All three of the above will declare 2 records, one based upon a type that was created, the next based upon the table structure, and the third based upon a cursor result set. Access to the variables is based upon dot notation.

rec1.memvar1 := 1;

One of the nicest features is that you can fetch into a record. This reduces the number of variables to type up and also allows you to add columns to cursors without needing to find and update all the fetches.

An additional nicety is that if you change your tables to increase the width of columns the definition within your code is automatically increased as well. Although this can cause other side effects so still needs to be watched carefully.

The number of parameters you need to send to procedures can be reduced dramatically as well with records, which may or may not help with performance.

flag

1 Answer

vote up 1 vote down

This is surely no trivial feature (both implementing and using). But when I think of the long lists of variables declared in nested procedure levels a record would come in handy.

Of course there has to be some calling convention to pass records as references, avoiding the need to copy all members to and fro. There seems to be something like that already silently working for long varchars.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.