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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:52:07+00:00 2026-06-18T11:52:07+00:00

can I use a case in oracle 11g to do some operations(within PL/SQL) or

  • 0

can I use a case in oracle 11g to do some operations(within PL/SQL) or it has to return a value, I mean, i can do this in mysql:

Select <column> from <table> where <conditions>;

case <column>   
 when 1 then      
  -- Quite many processes, queries, inserts, etc   
 when 2 then  
  -- some complex code  
-- And so on

Is it possible to achieve in oracle ?
I also would like to know if I can do this, ’cause im getting an oracle error in that line
i mean, set some variables in ELSE’s Case statement

CASE WHEN <condition> THEN varY := z ELSE var1:= x, var2:=x, var3:=y END
  • 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-18T11:52:08+00:00Added an answer on June 18, 2026 at 11:52 am

    If you’re really talking about PL/SQL, the code you can certainly do multiple operations in a CASE statement. The code that you posted should work just fine other than the syntax error where a CASE statement in PL/SQL ends with END CASE not END.

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    l_var1 number := 4;
      3    l_var2 number := 8;
      4  begin
      5    case when l_var1 = l_var2
      6         then l_var1 := 12;
      7         else
      8            l_var1 := 10;
      9            l_var2 := 6;
     10            dbms_output.put_line( 'I''m in the ELSE clause' );
     11     end case;
     12* end;
    SQL> /
    I'm in the ELSE clause
    
    PL/SQL procedure successfully completed.
    

    If you are talking about SQL, rather than PL/SQL, then no, you cannot embed procedural statements like assigning PL/SQL variables in a CASE statement in SQL.

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

Sidebar

Related Questions

Is there a way in SQL SERVER or ORACLE that can use the case
How can I use output caching with a .ashx handler? In this case I'm
So Oracle has NULLS FIRST, which I can use to have null values sorted
Is it possible to determine where Oracle is installed using pure PL/SQL? Use case:
What are some useful Oracle optimizations one can use for an Application that mostly
The use case I can think of is the following: In a typical application,
A very simple use case for creating users in webapp2/appengine can be as follows:
I use VS2008 targetting .NET 2.0 Framework, and, just in case, no I can't
I can use this maven plugin maven-jaxb-plugin to generate Java Classes from XSD file.
I ran into a weird behavior from Oracle this morning... And I can't understand

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.