Solved

How retrieve a view from an SQL query on iSeries?

Posted on 2011-09-26
6
539 Views
Last Modified: 2012-06-21
Hi everyone, I created an sql view on an iseries; however, I don't know how to view it and see the results.

I created the sql using strsql and then going through the prompts.  I know the view is there, because I can drop it- but I can't see it.

Can someone help me, I've a 400 novice.
0
Comment
Question by:Anthony6890
  • 4
  • 2
6 Comments
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 36599531
You use a view in a SELECT query just like you would use a table:
 
strsql
select * from yourviewnamegoeshere

- Gary Patterson
0
 
LVL 1

Author Comment

by:Anthony6890
ID: 36599843
Hey Gary,

Thanks for the help yet again.  How do I alter that view?  I ask because when I run that command for my query, I get this error:  Selection error involving field *N.

I would assume it has something to do with my query criteria.  
0
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 36600079
Drop the view and re-create it.

- Gary
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 35

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 36600150
Before you create a view, test the SELECT clause by executing it and verifying that it works.  Once you have a working SELECT statement, stick the CREATE VIEW clause in front of it:

Get the SELECT working first:

        SELECT LASTNAME, WORKDEPT FROM  CORPDATA.EMPLOYEE
        WHERE JOB = 'MANAGER'

Once you have the bugs out and it works, then insert the CREATE VIEW clause:

CREATE VIEW CORPDATA.EMP_MANAGERS AS
        SELECT LASTNAME, WORKDEPT FROM  CORPDATA.EMPLOYEE
        WHERE JOB = 'MANAGER'

In STRSQL, you can use F9 and F10 to pull down and edit previous statements.

- Gary Patterson
0
 
LVL 1

Author Comment

by:Anthony6890
ID: 36600408
Ahhh- thanks for the info Gary.

Very handy.

I appreciate it.

-Anthony
0
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 36600422
Happy to help.

- Gary
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question