SELECT
-- COLUMN_NAME,
-- _分割之后的第一段
concat( SUBSTRING_INDEX(LOWER(column_name), '_', 1),
-- _分割之后的第二段
SUBSTR(
UPPER(column_name),
LENGTH(
SUBSTRING_INDEX(column_name, '_', 1)
) + 2,
1
),
SUBSTR(
LOWER(column_name),
LENGTH(
SUBSTRING_INDEX(column_name, '_', 1)
) + 3,
LENGTH(
SUBSTRING_INDEX(column_name, '_', 2)
) - LENGTH(
SUBSTRING_INDEX(column_name, '_', 1)
) - 2
), -- _分割之后的第三段
SUBSTR(
UPPER(column_name),
LENGTH(
SUBSTRING_INDEX(column_name, '_', 2)
) + 2,
1
),
SUBSTR(
LOWER(column_name),
LENGTH(
SUBSTRING_INDEX(column_name, '_', 2)
) + 3,
LENGTH(
SUBSTRING_INDEX(column_name, '_', 3)
) - LENGTH(
SUBSTRING_INDEX(column_name, '_', 2)
) - 2
),
-- _分割之后的第四段
SUBSTR(
UPPER(column_name),
LENGTH(
SUBSTRING_INDEX(column_name, '_', 3)
) + 2,
1
),
SUBSTR(
LOWER(column_name),
LENGTH(
SUBSTRING_INDEX(column_name, '_', 3)
) + 3,
LENGTH(
SUBSTRING_INDEX(column_name, '_', 4)
) - LENGTH(
SUBSTRING_INDEX(column_name, '_', 3)
) - 2
)),
column_comment
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
table_name = 'scd_cost_charge_item';
原创文章,作者:306829225,如若转载,请注明出处:https://blog.ytso.com/275852.html