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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:43:40+00:00 2026-05-25T13:43:40+00:00

I know now how to store the result of sql procédure in shell variable

  • 0

I know now how to store the result of sql procédure in shell variable

testvar=$(sqlplus foo/bar @test.sql)

my test.sql return a list of integer that i would use in another select calling by my shell.
The aim of this procedure is to show the progress avancement of my treatment like

x=0;
while x <testvar.size
sqlplus foo/bar @test2.sql $testvar.x
print (x*100/testvar.size + "%")
end while 

(i dont know shell programming but it’s easiest than my current problem…

  • 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-25T13:43:41+00:00Added an answer on May 25, 2026 at 1:43 pm

    If the output of sqlplus is literally “A list of integers” as you describe, then this is easy enough.

    SOMETHING=5
    
    while -r read n ; do
        if [ $n -ge $SOMETHING ] ; then
            break
        fi
        sqlplus foo/bar @test2.sql "$n"
        printf '%.2f%%\n' $(expr "$n" \* 100 / "$SOMETHING")
    done < <(sqlplus foo/bar @test.sql)
    

    Presuming that “A list of integers” really means “A newline separated list of integers”

    It’s not clear to me what $testvar.x and testvar.size are supposed to represent, so I made some guesses and left the variable $SOMETHING to stand in for whatever testvar.size is supposed to be. If you want the total number of integers in the list from sqlplus then that would be different, and done like this:

    intlist=($(sqlplus foo/bar @test.sql))
    
    for n in "${intlist[@]}"; do
        if [ $n -ge ${#intlist[@]} ] ; then
            break
        fi
        sqlplus foo/bar @test2.sql "$n"
        printf '%.2f%%\n' $(expr "$n" \* 100 / ${#intlist[@]})
    done < <(sqlplus foo/bar @test.sql)
    

    If your output is more complex some additional filtering will need to be done up front.

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

Sidebar

Related Questions

Now I know about the normal CSS list styles (roman, latin, etc) and certainly
So I know now that the debug assemblies have been intentionally left out of
I have one main outstanding issue, I know now how to databind to lists
So, I now know what to save from nightly builds . What about when
Ive been tryin to solve this for a long time and now know why
Introduction: Now I know this question could be very broad and it would be
Now I know that bigint is 2^64; that is, more atoms than there are
I do not know javascript right now but I am planning on learning it.
using (FileStream fileStream = new FileStream(path)) { // do something } Now I know
Language Integrated Query. Now I know that the acronyms are. I have seen C#

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.