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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:02:40+00:00 2026-06-08T11:02:40+00:00

I have a basic table that looks like the following: SQL> desc comments Name

  • 0

I have a basic table that looks like the following:

SQL> desc comments
Name              Null?        Type
---------------------------------------
COMMENT_ID        NOT NULL     NUMBER
POST_ID           NOT NULL     NUMBER
USER_ID           NOT NULL     NUMBER
MESSAGE           NOT NULL     VARCHAR2(2500)
MESSAGE_TIME      NOT NULL     TIMESTAMP(6)
UPVOTES           NOT NULL     NUMBER

What I’d like to do is have a stored procedure be called that would increment the upvotes. This seems to make the most sense because I don’t want to pass in anything other than the comment_id and post_id.

I think I should be doing something like this (please excuse syntax, I haven’t messed with stored procedures in a long long time)

CREATE OR REPLACE procedure proc_upvote_comment (comment_id NUMBER , post_id NUMBER) 
BEGIN
    SELECT UPVOTES FROM COMMENTS 
        WHERE COMMENTS.COMMENT_ID  = proc_upvote_comment.comment_id 
              AND COMMENTS.POST_ID = proc_upvote_comment.post_id;
   //Call an update
END;
/

But I just don’t seem to know the missing piece here. I’ve tried looking at
http://docs.oracle.com/cd/B19306_01/appdev.102/b14251/adfns_packages.htm#i1007682
http://docs.oracle.com/cd/B12037_01/server.101/b10759/statements_6009.htm

And a few other places on the site – but I’m just missing something.

Any help in the right direction would be great

  • 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-08T11:02:42+00:00Added an answer on June 8, 2026 at 11:02 am

    Is there any reason this is not working for you:

     CREATE OR REPLACE procedure proc_upvote_comment (comment_id NUMBER , post_id NUMBER) 
     AS
     BEGIN
        UPDATE COMMENTS 
           SET UPVOTES = UPVOTES + 1
         WHERE COMMENTS.COMMENT_ID  = proc_upvote_comment.comment_id 
              AND COMMENTS.POST_ID = proc_upvote_comment.post_id;
     END;
    

    Remember that SQL works with sets 😉

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

Sidebar

Related Questions

I have a messaging system (very basic) that has a table like this: **MESSAGE_ID**
I have a basic string with holds a html table. The table looks like
I have another SQL/access 2007 question that seems really basic but I'm not sure
For example, I have a table which looks like this : id | name
I have an old table that I'm working with, which looks like this: +------------------+--------------+------+-----+---------+-------+
I have a section of T-SQL code that looks something like this: select @automation_rate
I have a very basic mysql table called memberships, that tracks which people belong
I have a recordset that looks like this: DocID (Primary Key) | Version |
I have 2 tables: users and log. Currently my query looks like that. $stmt
I have a very basic Table structure to be placed in middle/center of the

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.