Posts

Showing posts from September, 2020

SQL - Result offset and fetch first clauses

The result offset clause provides a way to skip the N first rows in a result set before starting to return any rows. The fetch first clause, which can be combined with the result offset clause if desired, limits the number of rows returned in the result set. The fetch first clause can sometimes be useful for retrieving only a few rows from an otherwise large result set, usually in combination with an ORDER BY clause. The use of this clause can give efficiency benefits. In addition, it can make programming the application simpler. Syntax OFFSET { integer-literal | ? } {ROW | ROWS} FETCH { FIRST | NEXT } [integer-literal | ? ] {ROW | ROWS} ONLY   ROW is synonymous with ROWS and FIRST is synonymous with NEXT. For the result offset clause, the value of the integer literal (or the dynamic parameter ?) must be equal to 0 (default if the clause is not given), or positive. If it is larger than the number of rows in the underlying result set, no rows are returned. For the fetch first c...

Oracle APEX - APEX COLLECTION

"APEX collections" is one of the most important features that come with Oracle APEX, and it can be used in many ways for different purposes, but in general, you can think of Apex collection as a temporary space to store complex data types — nonscalar — for instance, full row of data from a table or a view. This data can be manipulated in any way and then stored in table(s). Each Apex Collection can can has 50 varchar2 attributes (c001 -> c0050), 5 number attributes (n001->n005), 5 date attributes (d001->d005), 1 CLOB attribute (clob001), and 1 BLOB attribute (blob001). Each collection must have a unique name.  I will only show some basic steps. For a more detailed explanation please follow the official APEX documentation Create an APEX_COLLECTION: In this example I check if my collection exists and if not then I will create a new one and add some rows.  begin  if not apex_collection.collection_exists('DATA_COLLECTION') then    apex_collection.cr...