Taggato: pl sql

Nested table

In PL SQL esiste una raccolta di dati efficiente e adattabile: la tabella annidata. La tabella annidata è simile a una matrice unidimensionale ma con alcune differenze: Un array ha il numero di dichiarazioni di elementi, la tabella nidificata no. La dimensione della tabella nidificata può aumentare utilizzando il metodo di estensione. Un array ha sempre elementi consecutivi: la tabella annidata ha inizialmente elementi consecutivi ma può diventare sparsa quando gli elementi vengono eliminati. Per creare una tabella nidificata devi usare questa sintassi: type type_name is table of element_type[size element]; table_name type_name; Di seguito un esempio di creazione e utilizzo...

Record data type

In Pl Sql esistono molti tipi di dati: varchar2, number, float, double, boolean, ecc, ma può capita di voler utilizzare una struttura che contiene diversi tipi di dati, la chiamiamo tipo Record. È semplicemente un nuovo tipo di dati. Il tipo di record è formato da un gruppo di una o più colonne con proprie nome e tipo di dati. Per creare il tipo di record è necessario utilizzare la parola chiave TYPE in modo da istruire il compilatore su questo nuovo tipo di dati. Ci sono due modi per crearlo, il primo è a “livello di database” che può...

Oracle PL/SQL: implicit vs explicit cursors

PL / SQL emette un cursore implicito ogni volta che si esegue un’istruzione SQL direttamente nel codice, a condizione che tale codice non utilizzi un cursore esplicito. Viene chiamato cursore “implicito” perché non si dichiara esplicitamente un cursore per l’istruzione SQL. Se utilizzi un cursore implicito, Oracle esegue automaticamente le operazioni di apertura, recupero e chiusura; queste azioni sono al di fuori del tuo controllo programmatico. Tuttavia, è possibile ottenere informazioni sull’istruzione SQL eseguita più di recente esaminando i valori negli attributi del cursore SQL impliciti, come spiegato più avanti in questo capitolo. Il cursore implicito è più semplice da...

Goal Search Algorithm

Description: Goal search algorithm or search algorithm of the limit of a monotonically increasing sequence bounded above. 1) Purpose: Research of limit of a monotonically increasing sequence bounded above. 2) Example: Suppose to want to create a 10 meters high tower with a tolerance of 10 millimeters, having a given number of bricks, each of different height, stacked one over another. To make the tower we will be obligated to use bricks in Last In First Out order. Suppose to have this stack of bricks named XdataTable: 908 906 832 454 464 522 45 229 5057 433 930 214 1...

Hide Pl/Sql source code

To hide PlSql source code you can use both: dynamic obfuscation the wrap utility You might have to wrap some of yours PlSql objects just to provide the security of your code. Once wrapped, your code can’t be displayed from the static data dictionary views [ *_SOURCE ]. You can wrap the following types of PlSql objects Package specification Package body Type specification Type body Function Procedure However there are some utilities that you can use to read wrapped code, so it is not considered an high-security method to protect your code. Some limitations are wrapped files are not downward...

Execution flow of an sql statements

  The execution flow can be divided into four stage. Not all Sql Statements will use all the stages: Parse:  at the beginning the statement must be parsed, this mean check the syntax and associate it with the cursor. It also verifies if the privilege are correct and if the objects referenced really exists Bind:         this stage is execute only when the statement contain input data to be supplied at runtime. For each placeholder, values must be supplied to complete the SQL statement Execute:    at this point the server execute the statement, This is the...

Create triggers on system events

System events are particular database states that can be used to fire a system trigger. Is possibile to create triggers for these events at DATABASE or SCHEMA level. When a triggering event occurs, the database will open an autonomous transaction scope, fire the trigger and commit any transaction imbedded in the trigger. The available system events are: AFTER STARTUP        Causes the DataBase to fire the trigger whenever the database is opened. This event is valid only with DATABASE, not with SCHEMA BEFORE SHUTDOWN      Causes the DataBase to fire the trigger whenever an instance of the...