sql - Need MySQL shorthand to match param to column specsm - Stack Overflow

admin2025-04-29  1

I'm building the DB foundation (MySQL) of a new programming project and I'm starting to build the CRUD procedures for the core tables.

To save time in the future, in case the size of a column changes, I'd like to know if there is a shorthand for referencing the exact specs of a column as the data type of a CRUD parameter populating (or editing) that column. That way, I don't have to readjust every parameter that ultimately relates to the altered column.

In other words, what would replace the bracketed blocks shown?

CREATE TABLE 'example_tbl' (
(
   'clmn1' varchar(100),
   'clmn2' decimal(14,2)
)

CREATE PROCEDURE 'record_create'
(
  param1 [type of example_tbl.clmn1],
  param2 [type of example_tbl.clmn2]
)
BEGIN
  INSERT INTO example_tbl
  (
    clmn1,
    clmn2
  )
  VALUES
  (
    param1,
    param2
  )
END

EDIT & CLARIFICATION: I did some digging into past job lives and discovered that I was thinking of PL-SQL's %type function. I don't suppose that anyone knows of a MySQL equivalent?

Thanks.

转载请注明原文地址:http://anycun.com/QandA/1745940951a91420.html