Skip to main content

Overview

Updates the name of an existing position in tab_cargos.

Signature

fun_update_cargos(
    wid_cargo INTEGER,
    new_nom_cargo VARCHAR
) RETURNS BOOLEAN

Parameters

wid_cargo
INTEGER
required
Position ID to update
new_nom_cargo
VARCHAR
required
New position name

Returns

  • TRUE - Position updated successfully
  • FALSE - Update failed

Example Usage

-- Update position name
SELECT fun_update_cargos(1, 'cargo actualizado');

-- Update to 'senior developer'
SELECT fun_update_cargos(1, 'senior developer');

Validation Rules

  • Position ID must exist in the table
  • New position name cannot be NULL
  • Position name must meet length requirements

Error Handling

SQL StateDescription
23505NULL value in ID field
23514Value violates check constraint
02000Position ID does not exist
23502Attempted to insert NULL value
othersUnknown error

Source

source/func/cargos/fun_update_cargos.sql

Build docs developers (and LLMs) love