Default variable value in Oracle DB query

Hi, friends!

I have a problem in my query to Oracle DB. I trying execute query with default variable value some like this:

SELECT p.*
FROM products p
WHERE p.createdAt = [[ {{dateOfCreation}} #]]CURRENT_DATE()

But in response i take error ORA-00907: missing right parenthesis. How to pass the default value in this case?

Much thanks!

P.S. Environments: Oracle DB 12c, Metabase 0.39.3

Hi @rchernov
Oracle uses -- for comment syntax instead of #
And if you're using Field Filters, then you don't include the column in the query, which means you'll have to include it after the comment.

1 Like

Hello @flamber, I tried out using -- as the comment syntax as I'm also connecting to Oracle (11G), but I'm not getting the desired result

What am I missing?

{
  "browser-info": {
    "language": "en-US",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.16.1+1",
    "java.vendor": "Eclipse Adoptium",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "11.0.16.1",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.16.1+1",
    "os.name": "Linux",
    "os.version": "3.10.0-1160.36.2.el7.x86_64",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "h2",
      "oracle",
      "mysql"
    ],
    "hosting-env": "unknown",
    "application-database": "mysql",
    "application-database-details": {
      "database": {
        "name": "MySQL",
        "version": "8.0.19"
      },
      "jdbc-driver": {
        "name": "MariaDB Connector/J",
        "version": "2.7.6"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2022-10-17",
      "tag": "v0.44.5",
      "branch": "release-x.44.x",
      "hash": "29fab4d"
    },
    "settings": {
      "report-timezone": "Africa/Lagos"
    }
  }
}```