I'm having a problem with a Ruby heredoc i'm trying to make. It's returning the leading whitespace from each line even though i'm including the - operator, which is supposed to suppress all leading whitespace characters. my method looks like this:
def distinct_count
<<-EOF
SELECT
CAST('#{name}' AS VARCHAR(30)) as COLUMN_NAME
,COUNT(DISTINCT #{name}) AS DISTINCT_COUNT
FROM #{table.call}
EOF
end
and my output looks like this:
=> " SELECT
CAST('SRC_ACCT_NUM' AS VARCHAR(30)) as
COLUMN_NAME
,COUNT(DISTINCT SRC_ACCT_NUM) AS DISTINCT_COUNT
FROM UD461.MGMT_REPORT_HNB
"
this, of course, is right in this specific instance, except for all the spaces between the first " and . does anyone know what i'm doing wrong here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…