Solved

How retrieve a view from an SQL query on iSeries?

Posted on 2011-09-26
6
559 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Gain an elementary understanding of Blockchain technology.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

707 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