Skip to main content

Overview

Inserts a new position record into tab_cargos with an auto-incremented ID.

Signature

fun_insert_cargos(
    wnom_cargo VARCHAR
) RETURNS BOOLEAN

Parameters

wnom_cargo
VARCHAR
required
Position name (3-40 characters)

Returns

  • TRUE - Position inserted successfully
  • FALSE - Insert failed

Example Usage

-- Insert a new position
SELECT fun_insert_cargos('developer');

-- Insert another position
SELECT fun_insert_cargos('project manager');

Validation Rules

  • Position name must be between 3 and 40 characters
  • Position name cannot be NULL
  • Duplicate position names are not allowed

Error Handling

SQL StateDescription
23505NULL value in ID field
23514Value violates check constraint
othersUnknown error during insert

Source

source/func/cargos/fun_insert_cargos.sql

Build docs developers (and LLMs) love