PL/SQL Procedures, Functions, and Triggers
PL/SQL Procedure EJ1
This PL/SQL procedure inserts data into the PERMISOS
table based on data from the USUARIOS
table.
CREATE OR REPLACE PROCEDURE EJ1(
p_ciudad usuarios.ciudad%TYPE,
p_dpto usuarios.dpto%TYPE,
p_total OUT number
) AS
CURSOR c_usuarios IS
SELECT idu, dpto
FROM usuarios
WHERE dpto = p_dpto AND ciudad = p_ciudad;
BEGIN
p_total := 0;
FOR v_registro IN c_usuarios LOOP
INSERT INTO PERMISOS VALUES (v_registro.idu, p_dpto, 'DELETE',
Read More
SQL Database Schema: Library Data Model
Exercise 1: Library Database Schema
This document outlines the SQL code for creating a library database, including tables for publishers, distributors, customers, articles (books and journals), and rentals. It also includes sample queries for data insertion and retrieval.
Database Initialization
DROP DATABASE IF EXISTS library;
CREATE DATABASE IF NOT EXISTS library;
USE library;
Table Creation
Publisher Table
Stores information about publishers.
CREATE TABLE publisher (
id INT AUTO_INCREMENT PRIMARY
Read More
HTML Param Tag: Definition and Usage
HTML <param> Tag: Defining Parameters for Objects
The <param>
tag defines parameters for an <object>
element. It allows you to pass information to the object, such as settings or initial values.
Key Attribute: name
The name
attribute specifies the name of the parameter. In the example below, the parameter name is “property”.
Example:
<div> <param name="property" value="objA"></div>
Usage Notes:
- The
<param>
tag must be placed inside an<object>
element. - The
Essential MySQL Commands and Operations
Listing Databases
To list all databases:
mysql> SHOW DATABASES;
Listing Tables in a Database
To list all tables in the currently selected database:
mysql> SHOW TABLES;
Describing a Table’s Format
To describe the format of a table:
mysql> DESCRIBE table;
Creating a Database
To create a new database:
mysql> CREATE DATABASE db_name;
Creating a Table
To create a new table:
mysql> CREATE TABLE table_name (field1_name TYPE(SIZE), field2_name TYPE(SIZE));
Ex: mysql> CREATE TABLE pet (name VARCHAR(20)
Read More
Oracle Database Performance Tuning: Shared Pool & Statistics
Shared Pool Analysis
Selecting Shared Pools for Performance Analysis:
To determine the best performing shared pools, use the following query:
SELECT SHARED_POOL_SIZE_FOR_ESTIMATE TAMANHO_EM_MB, SHARED_POOL_SIZE_FACTOR, ESTD_LC_TIME_SAVED TEMPO FROM V$SHARED_POOL_ADVICE;
Checking Shared Pool Size:
To check the current shared pool size, execute:
SHOW PARAMETER SHARED_POOL_SIZE
Altering Shared Pool Size:
To modify the shared pool size, for example, to 60MB, use:
ALTER SYSTEM SET SHARED_POOL_SIZE = 60M;
Oracle
Read MoreJavaScript Image Rotator and Opacity Effects
JavaScript Image Rotator
Slide del ejercicio 1