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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:45:23+00:00 2026-06-14T05:45:23+00:00

I am writing a script to be run in sqlplus 11. I have a

  • 0

I am writing a script to be run in sqlplus 11. I have a user defined variable called compression. If this is true then I want to run the script CreateTablesCompression, otherwise run. I have the following:

decode(compression,'true',@@CreateTablesCompression,@@CreateTables);

However,when I run this I am thrown the error: unknown command beginning “decode…

Am I missing something here, I can’t see why SQLPlus wouldn’t recognise decode?

  • 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-14T05:45:24+00:00Added an answer on June 14, 2026 at 5:45 am

    Decode is not a SQL*PLUS command, you cannot use it directly in sql*plus only inside a pl/sql block or a query. So here is an example of how a conditional branching can be done:
    We declare a variable flag which going to regulate which one of two available scripts to run.

    SQL> variable flag varchar2(7);
    SQL> exec :flag := 'true';
    
    PL/SQL procedure successfully completed.
    
    SQL> column our_script new_value script noprint;
    SQL> select decode(:flag, 'true', 
      2                'c:\sqlplus\script1.sql', 
      3                'c:\sqlplus\script2.sql'
      4                ) our_script
      5  from dual;
    
    
    
    
    SQL> @&script;
    
    SCRIPT                                                                          
    --------                                                                        
    script_1                                                                        
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a bash script called 'run' that tests programs with pre-defined inputs. It
I am writing a shell script to run bunch of queries in postgres. This
I am writing a script which will do this: #!/bin/bash mysqldump -u user -p
I'm writing a simple script to run bunch of tasks in parallel using the
I'm writing a script that is supposed to run around a bunch of servers
I am writing installation script for my program, which is supposed to run on
The Ruby script i am writing is going to be run every morning and
I am writing a bash script to run an integration test of a tool
I'm writing a script that makes some trivial changes and then commits them to
I'm writing a shell script which performs some operation on files. This script will

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.