Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6882253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:13:50+00:00 2026-05-27T05:13:50+00:00

I get error when I use this: PROCEDURE GET_BY_CRIT(vchFilter varchar2(500), intCantTotal OUT INT, curResult

  • 0

I get error when I use this:

PROCEDURE GET_BY_CRIT(vchFilter varchar2(500),
                      intCantTotal OUT INT,
                      curResult OUT sys_refcursor)
IS
BEGIN

    OPEN curResult FOR
    'SELECT COLUMN1,COLUMN2 FROM SOME_TABLE WHERE '||vchFilter

    EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM SOME_TABLE WHERE '||vchFilter 
    INTO intCantTotal 
END

Error:

ORA-00936: missed expression 

But when I execute each sentence by separate it run correcly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:13:51+00:00Added an answer on May 27, 2026 at 5:13 am

    The error you’re getting doesn’t seem to make sense. Oracle should be throwing a compilation error because parameters to functions don’t have a length. vchFilter should be declared as a VARCHAR2, not a VARCHAR2(500).

    Additionally, as Lolo pointed out in the comments, statements in a PL/SQL block need to be terminated with semicolons.

    PROCEDURE GET_BY_CRIT(vchFilter varchar2,
                          intCantTotal OUT integer,
                          curResult OUT sys_refcursor)
    IS
    BEGIN
        OPEN curResult FOR
        'SELECT COLUMN1,COLUMN2 FROM SOME_TABLE WHERE '||vchFilter;
    
        EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM SOME_TABLE WHERE '||vchFilter 
        INTO intCantTotal;
    END;
    

    Be aware as well that there is no guarantee that second SQL statement will see the same COUNT that the first SQL statement did unless you can guarantee that SOME_TABLE is not being modified by any other sessions at the same time you’re querying it. I’d generally be rather wary of a need to run a query and execute a separate count– that generally indicates a more basic problem. If you need the COUNT to be consistent with the query you’re running, you’d want to add an analytic COUNT to your query and let the caller fetch that column.

    PROCEDURE GET_BY_CRIT(vchFilter varchar2,
                          curResult OUT sys_refcursor)
    IS
    BEGIN
        OPEN curResult FOR
        'SELECT COLUMN1,COLUMN2, COUNT(*) OVER () cnt FROM SOME_TABLE WHERE '||vchFilter;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following jquery statements but i get error in this function onGetDataSuccess(result)
I get this error when I try to use time_ago_in_words : Comparison of String
Why do I get this error message with this code? Use of undeclared identifier
In perl 5.8.5, if I do the following, I don't get an error: use
When compiling my project, I get the error: Error: D:\Programming\Projects\Aprovado\examwindow.cpp:6: error: invalid use of
In the below sql statement i get the following error Cannot use an aggregate
When I use (1) in my xhtml, I get an error as in (2).
Currently, when I get an error on an erb template (for use with HTTPServer/cgi)
when I seem to use parameters in my query, I get an error Invalid
I get the following error when attempting to use django-openid-auth OpenID discovery error: No

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.