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 8404643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:39:04+00:00 2026-06-09T22:39:04+00:00

Is it possible to create a rowtype for a table name which is passed

  • 0

Is it possible to create a rowtype for a table name which is passed as a parameter to a Stored-Procedure and also how do i know the columns to address them in the DBMS_OUUTPUT.PUT_LINE() statement.

The end user can give any user name(schema) and table name

I want to do something as below but it does not work.

 CREATE OR REPLACE PROCEDURE SP_PASS(USER_NAME VARCHAR2,TAB_NAME IN VARCHAR2)
 AS
    TYPE REF_CUR IS REF CURSOR;
    V_ARR REF_CUR;
    V_SQL VARCHAR(200);
    V_ROWTYPE USER_NAME.TAB_NAME%ROWTYPE;
 BEGIN
     V_SQL := 'SELECT * FROM '||USER_NAME||'.'||TAB_NAME;
     OPEN V_ARR FOR V_SQL;
     LOOP
     FETCH V_ARR INTO V_ROWTYPE;
     EXIT WHEN V_ARR%NOT FOUND;
     DBMS_OUTPUT.PUT_LINE(V_ROWTYPE.COL1||','||V_ROWTYPE.COL2||','||V_ROWTYPE.COL3);
     END LOOP;
     CLOSE V_ARR;
END;

Let me know if it is possible .

Thanks.

  • 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-06-09T22:39:05+00:00Added an answer on June 9, 2026 at 10:39 pm

    You can’t create a %ROWTYPE variable for an unknown table and you can’t statically refer to column names when you don’t know the table name at compile time.

    You can use the dbms_sql package to deal with completely dynamic SQL statements. You’ll need to prepare the SQL statement, describe the columns to find out the number of columns and their data types, bind appropriate variables, and then fetch the data. It’s a much more cumbersome way of writing code than the example you posted but it gives you extreme flexibility.

    There are a number of examples of using the dbms_sql package in the documentation I linked to. You may also want to check out Tom Kyte’s dump_csv function which writes the result of an arbitrary query to a CSV file using UTL_FILE. If you really want to write the data to DBMS_OUTPUT, you could simply replace the UTL_FILE calls with DBMS_OUTPUT. But I’m pretty sure you want to do something more useful than just writing the data to the DBMS_OUTPUT buffer so Tom’s procedure is probably closer to what you’re really trying to accomplish.

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

Sidebar

Related Questions

Hi it'd like to know if it's at all possible create a parametric equalizer
is it possible to create a custom NaN value in Python? I know a
i would like to know if this is possible: create a shared git repository
Possible Duplicate: Create new C++ object at specific memory address? I am writing what
Is it possible to create an SSIS package that can be passed a file
Possible Duplicate: Create a date with T-SQL I've a data table that stores each
Is it possible to create a browser extension which can change where the user
Is it possible to create an image with a link that also has a
Is possible create something like this without using ActionBar? I just need button which
Possible Duplicate: create smart device cab through msbuild I know MSBUild struggles to build

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.