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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:35:40+00:00 2026-05-16T21:35:40+00:00

I want to create a stored procedure like this: PROCEDURE P_CUSTOMER_UPDATE ( pADSLTable IN

  • 0

I want to create a stored procedure like this:

PROCEDURE P_CUSTOMER_UPDATE
  (
      pADSLTable IN Table,
      pAccountname IN NVARCHAR2,
      pStatus IN NUMBER,
      pNote IN NVARCHAR2,
      pEmail IN NVARCHAR2,
      pMobi IN NVARCHAR2,
      pServiceTypeID IN NUMBER,
      pDate IN DATE
  )
  IS
  BEGIN
      UPDATE pADSLTable
      SET STATUS = pStatus, NOTE = pNote, EMAIL = pEmail, MOBI = pMobi, SERVICETYPE_ID = pServiceTypeID, ACTIVATION_DATE = pDate
      WHERE ACCOUNT_NAME = pAccountname;
  END;

Of course, Oracle does not let me do that. Is there a way to work around this problem? Thank you very much.

  • 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-16T21:35:41+00:00Added an answer on May 16, 2026 at 9:35 pm

    You have several different tables with exactly the same column names and data types? Smells like a dodgy design.

    Anyway, we cannot use variables as database objects in straightforward SQL like that. We have to use dynamic SQL.

    PROCEDURE P_CUSTOMER_UPDATE
      (
          pADSLTable IN USER_TABLES.table_name%type,
          pAccountname IN NVARCHAR2,
          pStatus IN NUMBER,
          pNote IN NVARCHAR2,
          pEmail IN NVARCHAR2,
          pMobi IN NVARCHAR2,
          pServiceTypeID IN NUMBER,
          pDate IN DATE
      )
      IS
      BEGIN
          execute immediate 
              'UPDATE '||pADSLTable
              ||' SET STATUS = :1, NOTE = :2, EMAIL = :3, MOBI = :4, SERVICETYPE_ID = :5, ACTIVATION_DATE = :6'
              ||' WHERE ACCOUNT_NAME = :7'
          using pStatus, pNote, pEmail, pMobi, pServiceTypeID, pDate, pAccountname;
      END;
    

    One reason to avoid the use of dynamic SQL is that it is open to abuse. Malicious people can use the parameters to attempt to bypass our security. This is called SQL injection. I think people over estimate the significance of SQL injection. It’s not automatically a threat. For instance if the procedure is a private procedure in a package (i.e. not declared in the specification) it is unlikely that anybody will hijack it.

    But it is sensible to take precautions. DBMS_ASSERT is a package introduced in Oracle 10g to trap attempted SQL injection attacks. It this case it would be worth using it to validate the passed table name

    ....
    'UPDATE '|| DBMS_ASSERT.simple_sql_name(pADSLTable)
    ....  
    

    This would prevent anybody passing 'pay_table set salary = salary * 10 where id = 1234 --' as the table name parameter.

    Another reason to avoid dynamic SQL is that it is harder to get right and harder to debug. The syntax of the actual statement is only checked at run time. It is good to have a complete suite of unit tests which validate all the passed inputs, to ensure that the procedure doesn’t hurl a syntax exception.

    Finally, such dynamic SQL doesn’t show up in views such as ALL_DEPENDENCIES. This makes it harder to undertake impact analysis and locate all the programs which use a given table or column.

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

Sidebar

Related Questions

I want to write a stored procedure like this Create Proc dbo.GetApplicantsByIDs as Select
I have a really simple stored procedure that looks like this: CREATE PROCEDURE _Visitor_GetVisitorIDByVisitorGUID
I have a stored procedure like this: CREATE PROCEDURE up_action (@id int ,@group varchar(30)=''
I want to comment a stored procedure in Oracle something like this -- MODIFICATION
I want to create a stored procedure that takes the name of a table
I want to create a stored procedure (on SQL Server 2005) that fetches a
I have a stored procedure in which i want to create a user defined
I created a stored procedure so as to return me a table. Something like
I want to update a table's column using the results of a stored procedure
I am using CASE Statement in Stored procedure. I am using like create proc

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.