New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STRING_FORMAT built-in function [CORE1314] #1733
Comments
Modified by: @dyemanovassignee: Adriano dos Santos Fernandes [ asfernandes ] |
Modified by: @pcisarWorkflow: jira [ 12288 ] => Firebird [ 14795 ] |
Modified by: @asfernandes |
Commented by: Bert Herngreen (bertherngreen) CORE1341, 'Date format when casting as varchar', is closed and marked as a duplicate of this CORE1314. Therefore I ask my question here: What about a (non-sql-standard) extension of CAST e.g.: CAST (START_DATE AS CHAR(8) FORMAT 'yyyymmdd') Bert |
Modified by: @asfernandes |
Commented by: @WarmBooter A format function would be nice, like described in CORE1341. I dont think this issue is the same as described in 1341. A function to be able to format dates and numbers (money, etc) would be nice addition to the internal function list. |
Commented by: @mrotteveel The syntax suggested by Bert Herngreen is almost the same as defined in the standard (SQL:2016-2 6.13 <cast specification>): """ <cast operand> ::= <cast target> ::= <cast template> ::= Where <cast template> follows the rules of Subclause 9.42, "Converting a datetime to a formatted character string" or Subclause 9.43, "Converting a formatted character string to a datetime". |
Submitted by: Alexander Tyutik (tut)
Relate to CORE832
Is duplicated by CORE1341
Is duplicated by CORE3776
Votes: 10
I propose to add function which may be very convinient when working with dynamic SQL, exceptions, ets...
--------
STRING_FORMAT
--------
Function:
STRING_FORMAT(STR BY P0[, P1,...,PN]) returns STR whis all markers replaced by parameters
Example:
IF (...) THEN
EXCEPTION ERROR STRING_FORMAT("Error during inserting into table {0}. Field {1} has incorrect value {2}" BY 'MY_TABLE', 'CULUMN1', COALESCE(NEW.COLUMN1, '<NULL>'))
Result excetion message is: Error during inserting into table MY_TABLE. Field CULUMN1 has incorrect value 12345"
The text was updated successfully, but these errors were encountered: