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

  • Home
  • SEARCH
  • 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 6345725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:52:48+00:00 2026-05-24T20:52:48+00:00

I have this procedure in one of the packages: PROCEDURE get_namelist ( return_code_out OUT

  • 0

I have this procedure in one of the packages:

PROCEDURE get_namelist
  (
    return_code_out OUT VARCHAR2,
    return_msg_out OUT VARCHAR2,
    id_no_in IN employee.id_no%TYPE,
    name_out OUT employee.name%TYPE,
        addr_out OUT employee.addr%TYPE
  )
  IS

  BEGIN

    return_code_out := '0000';
    return_msg_out := 'OK';

    SELECT i.name, i.addr INTO name_out, addr_out
      FROM employee i
     WHERE i.id_no = id_no_in;

END get_namelist;

I am calling this procedure like this in my Java:

DbUtil db = null;
java.sql.CallableStatement cstmt = null;


db = new DbUtil();
cstmt = db.prepareCall("{ call jack.PACK_EMPLOYEE.get_namelist(?, ?, ?, ?, ?) }");

cstmt.registerOutParameter(1,OracleTypes.VARCHAR);
cstmt.registerOutParameter(2,OracleTypes.VARCHAR);
cstmt.setString(3,this.getIdNo());
cstmt.registerOutParameter(4,OracleTypes.VARCHAR);
cstmt.registerOutParameter(5,OracleTypes.VARCHAR);
stmt.execute();

this.setName(cstmt.getString(4));
this.setAddress(cstmt.getString(5));

Currently it’s pulling all data from the table. I want to change this, so it will pull a certain number of rows into multiple pages. I looked all over and found out how to do JSP pagination when I am using the SQL query in Java code itself, but I coudn’t find any example that shows this using package and callable statement.

How can I modify this code so I can use JSP pagination?

  • 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-24T20:52:48+00:00Added an answer on May 24, 2026 at 8:52 pm

    Add Page Size and Page Number to your Procedure.

    Add Row numbering over your query, and then return the records where row number > ((page size – 1) * page number + 1) and row number <= (page size * page number)

    If you need a more low level answer, I can translate this into the relevant code.


    DISCLAIMER: My Oracle Syntax may be terrible. Refer to Oracle ROW_NUMBER description (very last example) for how I attempted to construct this.

    //procedure

    PROCEDURE get_namelist
      (
        return_code_out OUT VARCHAR2,
        return_msg_out OUT VARCHAR2,
        id_no_in IN employee.id_no%TYPE,
        page_num IN (int datatype),              
        page_size IN (int datatype),             
        name_out OUT employee.name%TYPE,
           addr_out OUT employee.addr%TYPE,
      )
      IS
    
      BEGIN
    
        return_code_out := '0000';
        return_msg_out := 'OK';
    
        SELECT i.name, i.addr INTO name_out, addr_out, 
             FROM 
                 (SELECT e.name, e.addr,
                  ROW_NUMBER() OVER (ORDER BY e.name) as row           
                  FROM employee e
                  WHERE e.id_no = id_no_in) i
             WHERE row between ((page_num - 1) * page_size) AND (page_num * page_size);
    
    END get_namelist;
    

    //java

    DbUtil db = null;
    java.sql.CallableStatement cstmt = null;
    
    
    db = new DbUtil();
    cstmt = db.prepareCall("{ call jack.PACK_EMPLOYEE.get_namelist(?, ?, ?, ?, ?, ?, ?) }");
    
    cstmt.registerOutParameter(1,OracleTypes.VARCHAR);
    cstmt.registerOutParameter(2,OracleTypes.VARCHAR);
    cstmt.setString(3,this.getIdNo());
    cstmt.setString(4,pagenum);
    cstmt.setString(5,pagesize);
    cstmt.registerOutParameter(6,OracleTypes.VARCHAR);
    cstmt.registerOutParameter(7,OracleTypes.VARCHAR);
    stmt.execute();
    
    this.setName(cstmt.getString(4));
    this.setAddress(cstmt.getString(5));
    

    You call the procedure through Java with a different pagenum whenever you need a different page than the one displayed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one package contains many Stored Procedure for populating diffrent tables. This package
I have a mysql stored procedure from this ( google book ), and one
I have this procedure i my package: PROCEDURE pr_export_blob( p_name IN VARCHAR2, p_blob IN
I have written this stored procedure for one my operations in the database, but
I have this procedure that executes another procedure passed by a parameter and its
I have this stored procedure: CREATE OR REPLACE PROCEDURE LIQUIDACION_OBTENER ( p_Cuenta IN NUMBER,
I have this stored procedure for Oracle: create or replace procedure bns_saa_message_get() <--- PROBLEM
If I have this stored proc definition minus the body ALTER PROCEDURE sp_AlloctionReport(@where NVARCHAR(1000),
I have created a procedure with this structure but it doesn't work for datetime
I have written grammar for a language (sample code below) //this is a procedure

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.