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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:44:49+00:00 2026-05-27T23:44:49+00:00

I have a PROCEDURE that takes one Boolean input: `get_storage_choices_expanded`(IN usage_total INT(11), IN no_request1

  • 0

I have a PROCEDURE that takes one Boolean input:

 `get_storage_choices_expanded`(IN usage_total INT(11), IN no_request1 INT(8), IN no_request2 INT(8), IN reduced_redundancy_storage boolean)

But when I use it like:

call get_storage_choices_expanded(10,1,2,true);
select * from storage_choices_expanded
;

The result produced does not match with the same select query I have tested with. e.g.

(select *, 
    usage_each_plan * if(true,reduced_redundancy_storage, standard_storage) as price_storage, 
    concat_ws(' ',`Provider Name`,`Name`,`region_name`) as group_name,
    1 * request_group1_unit as "Number of Type1 Requests",
    2 * request_group2_unit as "Number of Type2 Requests",
    (1 * request_group1_price) as price_request1,
    (2 * request_group2_price) as price_request2
from 
  (SELECT *, 
    ( if((quota_band_high is not NULL) and 10>quota_band_high, quota_band_high, 10) - quota_band_low) as usage_each_plan
  FROM `cloud`.`storage_service_price`
  where 10 > quota_band_low and reduced_redundancy_storage > if(true,0, -1)
  ) as storage_usage_each_plan
)

The full code is as follows:

    -- --------------------------------------------------------------------------------
    -- Routine DDL
    -- --------------------------------------------------------------------------------
    DELIMITER $$

    CREATE DEFINER=`root`@`localhost` PROCEDURE `get_storage_choices_expanded`(IN usage_total INT(11), IN no_request1 INT(8), IN no_request2 INT(8), IN reduced_redundancy_storage boolean)
    BEGIN

    drop table if exists `cloud`.`storage_choices_expanded`;
    CREATE TEMPORARY TABLE `cloud`.`storage_choices_expanded` AS

      (select *, 
          usage_each_plan * if(reduced_redundancy_storage,reduced_redundancy_storage, standard_storage) as price_storage, 
          concat_ws(' ',`Provider Name`,`Name`,`region_name`) as group_name,
          no_request1 * request_group1_unit as "Number of Type1 Requests",
          no_request2 * request_group2_unit as "Number of Type2 Requests",
          (no_request1 * request_group1_price) as price_request1,
          (no_request2 * request_group2_price) as price_request2
      from 
        (SELECT *, 
          ( if((quota_band_high is not NULL) and usage_total>quota_band_high, quota_band_high, usage_total) - quota_band_low) as usage_each_plan
        FROM `cloud`.`storage_service_price`
        where usage_total > quota_band_low and reduced_redundancy_storage > if(reduced_redundancy_storage,0, -1)
        ) as storage_usage_each_plan
      ) 


    ;
    END

I have tried to replace boolean with bool, bit, TINYINT(1), but it doesn’t seem to make any difference.

The procedure can be called and run with no error, but the results are wrong.
call procedure returned rows with reduced_redundancy_storage value == 0 which is incorrect as it should be >0

  • 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-27T23:44:50+00:00Added an answer on May 27, 2026 at 11:44 pm

    I think the issue here is you have defined a parameter in stored procedure with the same name of a field exists in the database. Check whether a field exists with the name “reduced_redundancy_storage”.

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

Sidebar

Related Questions

I have a stored procedure that takes a user ID and calculates their balance
I have a stored procedure that takes no parameters, and it returns two fields.
I have a stored procedure that takes an XML parameter and inserts the Entity
I have a function that takes as one of it's arguments a VARRAY of
I have a stored procedure that takes a string of a pipe delimited array
I have a webpage that takes 10 minutes to run one query against a
I have a stored procedure that takes a comma-delimited string of IDs. I split
I have an ETL process that involves a stored procedure that makes heavy use
I have a fairly complex procedure that currently takes about 1:30 (min:sec) to complete.
Hello All I am using infragsitics tree view control.I have one stored procedure that

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.