このクエリを調べます。 SELECT SUBSTR(SYSDATE、1,5) '結果' FROM DUAL どのステートメントが正しいですか?
正解:B
In Oracle Database 12c, the SYSDATE function returns a date value in the current session's date format. The SUBSTR function is used to extract a substring from a string. However, SYSDATE is a DATE data type and not a string, so you cannot directly use SUBSTR on it. Therefore, SYSDATE must first be converted to a character data type using the TO_CHAR function before applying the SUBSTR function. Therefore, the correct form of the query should be: SELECT SUBSTR(TO_CHAR(SYSDATE), 1, 5) AS "Result" FROM DUAL; This converts the current date and time to a string using the default date format and then extracts the first 5 characters from it.