Skip to content
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

ORACLE RANDOM Synonym #986

Closed
capitantyler opened this issue Aug 26, 2022 · 2 comments · Fixed by #1002
Closed

ORACLE RANDOM Synonym #986

capitantyler opened this issue Aug 26, 2022 · 2 comments · Fixed by #1002

Comments

@capitantyler
Copy link

I am working with a sample in a Oracle ODBC.

con <- DBI::dbConnect(
  drv = odbc::odbc(), 
  dsn = "oracle_dsn"
)

my_table <- tbl(con, in_schema("my_schema", "my_table"))

n <- 100
my_table  %>% slice_sample(n = n) %>% show_query()

Showing this query

SELECT
  "column 1",
  "column 2",
   ....
FROM (
  SELECT
      "column 1",
     "column 2",
       ....,
    ROW_NUMBER() OVER (ORDER BY **RANDOM()**) AS "q02"
  FROM ("my_schema"."my_table") 
) "q01"
WHERE ("q02" <= 100)

But ORACLE does not recognize RANDOM without the package prefix dbms_random (that statement works replacing RANDOM() by dbms_random.RANDOM()).

I do not have privileges to make that synonym in my Oracle database, but I thought should do not assume a synonym.

Could you add the prefix or show me how to? Thanks.

@mgirlich
Copy link
Collaborator

mgirlich commented Sep 9, 2022

I added a PR to fix this. Can you confirm that this fixes the issue? You can install it via remotes::install_github("tidyverse/dbplyr#1002").

@capitantyler
Copy link
Author

It already works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants