Run Same Statement On Multiple Views

I have about 2000 views that I need to run a select statement on.  I 1st need to run a query that will check if state = 'AR' and if it does, I need it to return either yes or the view name.  So for example, how could I run this one statement on
all those views?
Select Count(*)
From firstviewinlist
Where [state] = 'Ar'
Currently I have the list of 2000 views to run this against (all on the same server) in Excel, wasn't sure if I was going to have to manually do it or build a massive unionall query - so thought I would ask for guidance here 1st.

This is what I came up in 10 mins. If you have views stored in multiple databases then change the database name and execute the script in each DB:
USE YourDB
GO
CREATE TABLE #T (ID INT IDENTITY NOT NULL, TableNames VARCHAR(1000))
CREATE TABLE #Final (TableNames VARCHAR(1000))
INSERT INTO #T (TableNames)
SELECT '['+C.TABLE_CATALOG+'].['+C.TABLE_SCHEMA+'].['+C.TABLE_NAME+']' TableName
FROM INFORMATION_SCHEMA.COLUMNS C
JOIN INFORMATION_SCHEMA.TABLES T ON C.TABLE_CATALOG = T.TABLE_CATALOG AND
C.TABLE_SCHEMA = T.TABLE_SCHEMA AND
C.TABLE_NAME = T.TABLE_NAME
WHERE T.TABLE_TYPE = 'View'
--AND C.TABLE_SCHEMA = 'dbo'
AND COLUMN_NAME = 'State'
GROUP BY '['+C.TABLE_CATALOG+'].['+C.TABLE_SCHEMA+'].['+C.TABLE_NAME+']'
DECLARE @N INT, @Str NVARCHAR(MAX), @TableName NVARCHAR(MAX)
SET @N = 1
WHILE (1=1)
BEGIN
SELECT @TableName = TableNames
FROM #T
WHERE ID = @N
SET @Str =
' INSERT INTO #Final(TableNames)
SELECT TOP 1 '''+@TableName+'''
FROM '+@TableName+'
WHERE EXISTS(SELECT 1 FROM '+@TableName+' WHERE [State] = ''Ar'') '
EXEC SP_EXECUTESQL @Str
IF @@ROWCOUNT = 0 BREAK;
SET @N = @N + 1
END
SELECT *
FROM #Final
--DROP TABLE #T, #Final
Hope it helps!
If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

Similar Messages

  • Multiple View sessions, same PC?

    View 6.0.1, Client 3.3.0
    Can I have multiple View sessions from the same PC? In other words
    Launch the Horizon View client, login, and access a desktop
    Launch the Horizon View client again, login as a different user, and access a different desktop
    Repeat until I have many session open at once
    The reason I ask is we are migrating from Exchange to Gmail. Google provides a utility called GAMME that in a larger environment can be run from multiple machines with each machine migrating one portion of the alphabet. Rather than using 10 physical machines I would rather use 10 View desktops. This will work slick if from my real PC I can access all 10 view desktops. I will be using a different login account to access each desktop.

    Have not tried yet. I did not want to go through the time setting up a separate non-persistent desktop pool if I could not login to more than one desktop at the same time. Now that I know it will work, I will run with it. Thanks for the help

  • Run invoke-command on multiple machines at the same time

    Hey all so I read that if I store my New-pssession in a variable then used that in my invoke-command it would run all computers at the same time.
    $a = Get-Content "C:\Users\cody-horton\Desktop\list.txt"
    $session
    for($i=0;$i -lt $a.Length;$i++){
    if(!(Test-Connection -Cn $a[$i] -BufferSize 16 -Count 1 -ea 0 -quiet)){
    Write-Host $a[$i] -foregroundcolor red
    else{
    $session = New-PSSession $a[$i]
    Invoke-Command -Session $session -FilePath "\\My computer\C`$\Users\public\Documents\zip folder.ps1"
    What exactly am I doing wrong I just need to run this script on multiple machines at the same time.
    Thanks.
    Edit: Also what would be the best way to close all the sessions thanks.

    Hi there,
    So what I think you are doing wrong here is that you are overwriting the value in $Session everytime you executed code inside for loop. try the below:
    $a = Get-Content "C:\Users\cody-horton\Desktop\list.txt"
    $session = @() #define this as an array
    for($i=0;$i -lt $a.Length;$i++){
    if(!(Test-Connection -Cn $a[$i] -BufferSize 16 -Count 1 -ea 0 -quiet)){
    Write-Host $a[$i] -foregroundcolor red
    else{
    $session += New-PSSession $a[$i] #add the new session to the array, at the end it will be a collection of sessions
    Invoke-Command -Session $session -FilePath "\\My computer\C`$\Users\public\Documents\zip folder.ps1" #I think the above one won't work..first you need to copy the script locally on the machine and then execute it#Why this won't work because of Second-Hop Authentication
    Have put comments where I edited your code.
    Hope this helps
    Knowledge is Power{Shell}. http://dexterposh.blogspot.com/

  • Can I view the same pdf on multiple iPads at the same time with 1 iPad operating as the master (controlling page turns etc)?

    Would like to use 4nr iPads as an autocue system. Can I view the same pdf on multiple iPads at the same time with 1 iPad operating as the master (controlling page turns etc) and the others operating as slaves? Can this be done without the use of 3G or a remote Wifi hub? I would appreciate your input.................

    Open the document in Acrobat Reader and use the menu Window > New Window.

  • Re: Running the same (Forte) application multiple times -for different

    Hi
    We had the same problem - how to deploy a number of identical applications, using each their own db.
    (for training).
    The solution we used is to wrap the entire application into different applications by using a very small
    module called KURSUS01, KURSUS02 etc, that did nothing but call the start procedure of the main app.
    Then in the dbsession connect, we made a call appname to get the application name, and appended the
    first 8 chars to the dbname. Thus our dbnames now points to logicals name: rdbdataKURSUS01, rdbdataKURSUS02 etc.
    All this allows us to deploy the identical apps in the same env, or change one version, and run both the old
    and new program on the same pc and server at the same time (eg. KURSUS01 and KURSUS02).
    I also think this is a kludge - but it works nicely!
    Jens Chr
    KAD/Denmark
    -----Original Message-----
    From: Haben, Dirk <[email protected]>
    To: 'Soapbox Forte Users' <[email protected]>
    Date: 15. januar 1999 09:41
    Subject: Running the same (Forte) application multiple times - for different business clients.
    Hi All
    We have a number of different business clients all willing to use our
    application.
    The (forte) application is to run on our machines etc for these (business)
    clients.
    All (business) clients will have their data kept in separate Oracle DBs
    (instance).
    The problem now is that the entire (forte) application is written using
    DBSessions.
    Now, depending on what business client needs to be serviced (so to speak) we
    need to attach to the right DB - or use the "right" SO.
    The two options we can think of are:
    Option1:
    Programatic change to somehow "know" what (business) client (DB) I'm talking
    about and then use the right DB.
    Pro:
    Only one forte environment to maintain
    Can run multiple (business) clients on same PC at the same time
    Con:
    Requires many program changes
    bending O-O rules(?)
    can't dynamically name SOs so can it be done at all? (ResourceMGRs maybe?)
    Option2:
    Use separate environments! One for each business client.
    Pro:
    More defined separation of app and data,
    SLA-easy
    Con:
    Maintain "n" number of environments
    Can only run the application for one environment (business client) at a time
    on one PC - Big Negative here!
    Not knowing any feasible solution to option 1 (without much code changes and
    developer moaning) I would go for option two; as I have already worked on
    multi-environment setups on VMS back at the Hydro (hi guys).
    I would appreciate any comments from anyone who has solved this problem.
    How, Why Pro Con etc.
    TIA,
    Dirk Haben
    Perth, WA
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hi
    We had the same problem - how to deploy a number of identical applications, using each their own db.
    (for training).
    The solution we used is to wrap the entire application into different applications by using a very small
    module called KURSUS01, KURSUS02 etc, that did nothing but call the start procedure of the main app.
    Then in the dbsession connect, we made a call appname to get the application name, and appended the
    first 8 chars to the dbname. Thus our dbnames now points to logicals name: rdbdataKURSUS01, rdbdataKURSUS02 etc.
    All this allows us to deploy the identical apps in the same env, or change one version, and run both the old
    and new program on the same pc and server at the same time (eg. KURSUS01 and KURSUS02).
    I also think this is a kludge - but it works nicely!
    Jens Chr
    KAD/Denmark
    -----Original Message-----
    From: Haben, Dirk <[email protected]>
    To: 'Soapbox Forte Users' <[email protected]>
    Date: 15. januar 1999 09:41
    Subject: Running the same (Forte) application multiple times - for different business clients.
    Hi All
    We have a number of different business clients all willing to use our
    application.
    The (forte) application is to run on our machines etc for these (business)
    clients.
    All (business) clients will have their data kept in separate Oracle DBs
    (instance).
    The problem now is that the entire (forte) application is written using
    DBSessions.
    Now, depending on what business client needs to be serviced (so to speak) we
    need to attach to the right DB - or use the "right" SO.
    The two options we can think of are:
    Option1:
    Programatic change to somehow "know" what (business) client (DB) I'm talking
    about and then use the right DB.
    Pro:
    Only one forte environment to maintain
    Can run multiple (business) clients on same PC at the same time
    Con:
    Requires many program changes
    bending O-O rules(?)
    can't dynamically name SOs so can it be done at all? (ResourceMGRs maybe?)
    Option2:
    Use separate environments! One for each business client.
    Pro:
    More defined separation of app and data,
    SLA-easy
    Con:
    Maintain "n" number of environments
    Can only run the application for one environment (business client) at a time
    on one PC - Big Negative here!
    Not knowing any feasible solution to option 1 (without much code changes and
    developer moaning) I would go for option two; as I have already worked on
    multi-environment setups on VMS back at the Hydro (hi guys).
    I would appreciate any comments from anyone who has solved this problem.
    How, Why Pro Con etc.
    TIA,
    Dirk Haben
    Perth, WA
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Can Numbers Display Multiple Views of the Same Table

    Hi,
    Excel and Appleworks both have a pull down tab on the vertical bar allowing multiple views into the same spreadsheet (table). Can Numbers do this?
    I have a set of calculations at the top of a spreadsheet that are based on years and years worth of data under the calculations (same column). I add data for each new event (the rows) and watch the calculations at the top of the data. Easy to do in Excel or Appleworks, but, I can't figure out how to do this in Numbers.
    Example:
    Spot1 Spot2
    Total 15 36
    Avg 5 12
    Jan 09 5 10
    Feb 09 6 20
    Mar 09 4 6
    Apr 09
    So... does Numbers allow the view "split" or multiple views that Excel and Appleworks allow?
    Thanks!
    Tom

    Question asked and responded several times:
    feature unavailable.
    For multiple views of a table there is an easy workaround as we may build a table whose every cells grab their contents from the 'master' one.
    _Go to "Provide Numbers Feedback" in the "Numbers" menu_, describe what you wish.
    Then, cross your fingers, and wait _at least_ for iWork'10
    Yvan KOENIG (VALLAURIS, France) mardi 1 septembre 2009 21:56:42

  • Running a query in a View Designer results in an error, but running the same query in a Query window works

    Hi everyone,
    Just as my title says, I have a query which I've written in a query window and it works perfectly.
    But when I try to add the query code into the view designer, it throws a Syntax error.
    Error in ON clause near '('.Unable to parse query text.
    Also, when running the query from the view designer (pressing red exclamation mark) I get a different error.
    SQL Execution Error.Executed SQL statement: SELECT Sku, ParentSku, UPC, ...Error Source: .Net SqlClient Data ProviderError Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
    Has anyone else experienced this and is there any workaround?
    I have tried to create the view with T-SQL (CREATE VIEW etc.), but when opening it in the view designer I get the error from the 1st image.
    Thank you,
    Radu

    Hi Radu,
    Yes, I have faced similar issue. I had a View and it was working totally fine but when once I opened it in via right click - View Design, it was giving parse error.
    Cause is that Query designer parse and executes the query without error but the way View designer works, it can't parse it.
    Later I ignored View desinger and just used T-SQL like CREATE/ALTER view.
    Workaround is to do right click on View - Script View as - CREATE To/ ATER To.
    Regarding Timeout error, again the issue with View designer which couldn't execute query in there and ended up with timeout error.
    If your SELECT query and SELECT * FROM YourView works fine in Query designer, you are good to go.
    Similar threads:
    View with errors still saved, and still works...
    Parsing error when creating view
    -Vaibhav Chaudhari

  • Multiple same states in a state machine

     Hi all,
    This is a follow up on a post at the wrong location.  I have attached one state in my state machine.  That state appears maybe 3 more times in the state machine, so maybe I should make it into a subvi instead, but I was thinking since there are not too many low level nodes and leaving the code in that state out of a subvi seems to be more clear, I thought maybe leaving the code out is better.  Not sure which way to go, please feel free to give me suggestion.
    Yik
    Kudos and Accepted as Solution are welcome!
    Attachments:
    ALRM_AlarmSummary_BD.png ‏19 KB

    If the state is the exactly the same I would not recommend copying it. If you need to make a change to the code you now have multiple places to make the update. Also, rather than making it clearer what is happening I think it leads to more confusion since someone looking at the code will spend time trying to figure out why there are multiple instances of the same state. If you want to document the flow (actually the state transitions) then simply document them and keep that document up to date. That documentation would most likely be easier to read and see what the system is doing then reverse engineering the code.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Enforcement States for multiple deployment ID's

    I would like to have a report for the enforcement states of multiple deployment ID's. I have tried manipulating the default "States 1 - Enforcement states for a deployment" to have multiple default values but have not succeeded in getting
    the report to run.
    In our Software Updates we have multiple collections targeting specific groups of computers and then we have specific update groups within specific date ranges deployed to those collections. In some cases I have multiple deployments targeting the same collection
    and thus the want to have a single report for the enforcement status of multiple deployment ID's.
    Unfortunatley my level of SQL reporting is minimal, does anyone have knowledge of a report or query to use multiple deployment ID's for returning the enforcement states?

    Hi,
    You may have a look on the following blog, hope this could help you edit your report.
    http://blogs.msdn.com/b/steverac/archive/2013/01/13/modifying-a-report-to-merge-software-update-deployments-with-updates-delivered-through-standard-software-distribution.aspx
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • DML operations on multiple views

    Hi all.
    I can't understand updateing the data on views which created by multiple table joining. Which columns I can update and why I'm getting
    ORA-01779: cannot modify a column which maps to a non key-preserved table error??
    Can anybody show me explanation with examples??
    Thanks...

    Modifying a Join View
    A modifiable join view is a view that contains more than one table in the top
    level FROM clause of the SELECT statement, and that does not contain any of
    the following:
    - DISTINCT operator
    - aggregate functions: AVG, COUNT, GLB, MAX, MIN, STDDEV, SUM, or VARIANCE
    - set operations: UNION, UNION ALL, INTERSECT, MINUS
    - GROUP BY or HAVING clauses
    - START WITH or CONNECT BY clauses
    - ROWNUM pseudocolumn
    With some restrictions, you can modify views that involve joins. If a view is
    a join on other nested views, then the other nested views must be mergeable
    into the top level view.
    The examples in following sections use the EMP and DEPT tables. These examples
    work only if you explicitly define the primary and foreign keys in these
    tables, or define unique indexes. Following are the appropriately constrained
    table definitions for EMP and DEPT:
      CREATE TABLE dept
        deptno NUMBER(4) PRIMARY KEY,
        dname VARCHAR2(14),
        loc VARCHAR2(13)
      CREATE TABLE emp
        empno NUMBER(4) PRIMARY KEY,
        ename VARCHAR2(10),
        job varchar2(9),
        mgr NUMBER(4),
        hiredate DATE,
        sal NUMBER(7,2),
        comm NUMBER(7,2),
        deptno NUMBER(2),
        FOREIGN KEY (DEPTNO) REFERENCES DEPT(DEPTNO)
    You could also omit the primary and foreign key constraints listed above, and
    create a UNIQUE INDEX on DEPT (DEPTNO) to make the following examples work.
      CREATE OR REPLACE VIEW emp_dept AS
        SELECT empno, ename, sal, e.deptno, dname, loc
        FROM EMP e, DEPT d
        WHERE e.deptno = d.deptno;
    Key-Preserved Tables
    The concept of a key-preserved table is fundamental to understanding the
    restrictions on modifying join views. A table is key preserved if every key of
    the table can also be a key of the result of the join. So, a key-preserved
    table has its keys preserved through a join.
    Note: It is not necessary that the key or keys of a table be selected for it
    to be key preserved. It is sufficient that if the key or keys were selected,
    then they would also be key(s) of the result of the join.
    Attention: The key-preserving property of a table does not depend on the
    actual data in the table. It is, rather, a property of its schema and not of
    the data in the table. For example, if in the EMP table there was at most one
    employee in each department, then DEPT.DEPTNO would be unique in the result of
    a join of EMP and DEPT, but DEPT would still not be a key-preserved table.
    If you SELECT all rows from EMP_DEPT view, the results are:
      SELECT * FROM EMP_DEPT;
      EMPNO ENAME  SAL DEPTNO  DNAME      LOC
       7369 SMITH   800     20 RESEARCH   DALLAS
       7499 ALLEN  1600     30 SALES      CHICAGO
       7521 WARD   1250     30 SALES      CHICAGO
       7566 JONES  2975     20 RESEARCH   DALLAS
       7654 MARTIN 1250     30 SALES      CHICAGO
       7698 BLAKE  2850     30 SALES      CHICAGO
       7782 CLARK  2695     10 ACCOUNTING NEW YORK
       7788 SCOTT  3000     20 RESEARCH   DALLAS
       7839 KING   5500     10 ACCOUNTING NEW YORK
       7844 TURNER 1500     30 SALES      CHICAGO
       7876 ADAMS  1100     20 RESEARCH   DALLAS
       7900 JAMES   950     30 SALES      CHICAGO
       7902 FORD   3000     20 RESEARCH   DALLAS
       7934 MILLER 1430     10 ACCOUNTING NEW YORK
      14 rows selected.
    In this view, EMP is a key-preserved table, because EMPNO is a key of the EMP
    table, and also a key of the result of the join. DEPT is not a key-preserved
    table, because although DEPTNO is a key of the DEPT table, it is not a key of
    the join.
    DML Statements and Join Views
    =============================
    !!!!!! IMPORTANT !!!!!! IMPORTANT !!!!!! IMPORTANT !!!!!! IMPORTANT !!!!!!
    Any UPDATE, INSERT, or DELETE statement performed on a join view can modify
    only *** one *** underlying base table.
    !!!!!! IMPORTANT !!!!!! IMPORTANT !!!!!! IMPORTANT !!!!!! IMPORTANT !!!!!!
    UPDATE Statements:
    The following example shows an UPDATE statement that successfully modifies the
    EMP_DEPT view:
      UPDATE emp_dept
      SET sal = sal * 1.10
      WHERE deptno = 10;
    The following UPDATE statement would be disallowed on the EMP_DEPT view:
      UPDATE emp_dept
      SET loc = 'BOSTON'
      WHERE ename = 'SMITH';
    This statement fails with an ORA-01779 error (cannot modify a column which
    maps to a non key-preserved table), because it attempts to modify the
    underlying DEPT table, and the DEPT table is not key preserved in the EMP_DEPT
    view.
    In general, all modifiable columns of a join view must map to columns of a
    key-preserved table. If the view is defined using the WITH CHECK OPTION
    clause, then all join columns and all columns of repeated tables are not
    modifiable.
    So, for example, if the EMP_DEPT view were defined using WITH CHECK OPTION,
    the following UPDATE statement would fail:
      UPDATE emp_dept
      SET deptno = 10
      WHERE ename = 'SMITH';
    The statement fails because it is trying to update a join column.
    DELETE Statements:
    You can delete from a join view provided there is one and only one
    key-preserved table in the join.
    The following DELETE statement works on the EMP_DEPT view:
      DELETE FROM emp_dept
      WHERE ename = 'SMITH';
    This DELETE statement on the EMP_DEPT view is legal because it can be
    translated to a DELETE operation on the base EMP table, and because the EMP
    table is the only key-preserved table in the join.
    In the following view, a DELETE operation cannot be performed on the view
    because both E1 and E2 are key-preserved tables:
      CREATE VIEW emp_emp AS
        SELECT e1.ename, e2.empno, deptno
        FROM emp e1, emp e2
        WHERE e1.empno = e2.empno;
    If a view is defined using the WITH CHECK OPTION clause and the keypreserved
    table is repeated, then rows cannot be deleted from such a view:
      CREATE VIEW emp_mgr AS
        SELECT e1.ename, e2.ename mname
        FROM emp e1, emp e2
        WHERE e1.mgr = e2.empno
        WITH CHECK OPTION;
    No deletion can be performed on this view because the view involves a
    self-join of the table that is key preserved.
    INSERT Statements:
    The following INSERT statement on the EMP_DEPT view succeeds:
      INSERT INTO emp_dept (ename, empno, deptno)
      VALUES ('KURODA', 9010, 40);
    This statement works because only one key-preserved base table is being
    modified (EMP), and 40 is a valid DEPTNO in the DEPT table (thus satisfying
    the FOREIGN KEY integrity constraint on the EMP table).
    An INSERT statement like the following would fail for the same reason that
    such an UPDATE on the base EMP table would fail: the FOREIGN KEY integrity
    constraint on the EMP table is violated.
      INSERT INTO emp_dept (ename, empno, deptno)
      VALUES ('KURODA', 9010, 77);
    The following INSERT statement would fail with an ORA-1776 error (cannot
    modify more than one base table through a view).
      INSERT INTO emp_dept (empno, ename, loc)
      VALUES (9010, 'KURODA', 'BOSTON');
    An INSERT cannot, implicitly or explicitly, refer to columns of a
    non-key-preserved table. If the join view is defined using the WITH CHECK
    OPTION clause, then you cannot perform an INSERT to it.
    Using the UPDATABLE_ COLUMNS Views
    The following views can assist you when modifying join views:
    View Name               Description
    USER_UPDATABLE_COLUMNS  Shows all columns in all tables and views in the
                            users schema that are modifiable.
    DBA_UPDATABLE_COLUMNS   Shows all columns in all tables and views in the
                            DBA schema that are modifiable.
    ALL_UPDATABLE_COLUMNS   Shows all columns in all tables and views that are
                            modifiable.

  • Complex Query - Joins vs Multiple Views

    I am trying to run a query that joins a main table representing people with 7 others that contain demographic and status information. Some of the other tables don't have records or have more than one record per person. For the instances of more than one phone number for a person, I need to filter out all but the active home number record. If the person doesn't have a phone number, I still need a record returned, just without a phone number listed. I have tried joining all the tables in a single query, but can't get every person to show up in the results. If the person doesn't have a phone number, or has a phone number that isn't both active and "Home" then they don't show up... I got around this by using multiple views to make sure everyone was pulled, but the multi level view runs slow as heck... Here are the two approaches. Any ideas?
    Here are the views that work:
    CREATE OR REPLACE VIEW pinnacle_address AS SELECT p.person_id, a.line1 &#0124; &#0124; ' ' &#0124; &#0124; a.line2 &#0124; &#0124; ' ' &#0124; &#0124; a.line3 AS StreetAddress, a.city, a.state, a.zip FROM cmn_people p, cmn_people_addresses a WHERE p.person_id=a.person_id(+) and a.Active_Address = 'Y' and a.Address_Type = 'Home';
    CREATE OR REPLACE VIEW pinnacle_phone AS SELECT p.person_id, ph.phone_number, ph.phone_number_type FROM cmn_people p, cmn_phone_nos ph WHERE p.person_id=ph.person_id(+) and ph.active_phone_number = 'Y' and ph.primary_flag = 'Y';
    CREATE OR REPLACE VIEW pinnacle_people AS SELECT p.person_identifier01, p.last_name, p.first_name, p.middle_name, p.date_of_birth, p.gender, a.StreetAddress, a.city, a.state, a.zip, ph.phone_number, ph.phone_number_type, p.email, p.ssn, p.ethnic, p.fulltime, p.person_id FROM cmn_people p, pinnacle_address a, pinnacle_phone ph WHERE p.person_id=a.person_id(+) and a.person_id = ph.person_id(+);
    CREATE OR REPLACE VIEW pinnacle_student AS SELECT DISTINCT p.person_identifier01, p.last_name, p.first_name, p.middle_name, p.date_of_birth, p.gender, p.streetaddress, p.city, p.state, p.zip, p.phone_number, p.email, p.ssn, p.ethnic, p.fulltime, i.student_instance_id, e.comb_id FROM sss_student_enrollments e, sss_student_instance i, pinnacle_people p, cmn_statuses s WHERE e.person_id=i.person_id and i.person_id=p.person_id and i.status_id=s.status_id and s.status in('Active', 'Accepted');
    Here's the single sql that doesn't:
    CREATE OR REPLACE VIEW pinnacle_test AS SELECT DISTINCT cp.PERSON_IDENTIFIER01, cp.LAST_NAME, cp.FIRST_NAME, cp.MIDDLE_NAME, cp.DATE_OF_BIRTH, cp.GENDER, cpa.LINE1 &#0124; &#0124; ' ' &#0124; &#0124; cpa.LINE2 &#0124; &#0124; ' ' &#0124; &#0124; cpa.LINE3 AS StreetAddress, cpa.CITY, cpa.STATE, cpa.ZIP, cph.PHONE_NUMBER, cp.EMAIL, cp.SSN, cp.ETHNIC, cp.FULLTIME, si.STUDENT_INSTANCE_ID, se.COMB_ID FROM SSS_STUDENT_ENROLLMENTS se, SSS_STUDENT_INSTANCE si, CMN_STATUSES cs, CMN_PEOPLE cp, (SELECT * FROM CMN_PEOPLE_ADDRESSES WHERE Active_Address = 'Y' and Address_Type = 'Home') cpa, (SELECT * FROM CMN_PHONE_NOS WHERE active_phone_number = 'Y' and primary_flag = 'Y') cph WHERE se.PERSON_ID = si.PERSON_ID and si.STATUS_ID = cs.STATUS_ID and si.PERSON_ID = cp.PERSON_ID and cp.PERSON_ID(+) = cpa.PERSON_ID and cpa.PERSON_ID(+) = cph.PERSON_ID and cs.status in ('Active', 'Accepted');
    Thanks in advance,
    Erik Marin
    [email protected]

    CREATE OR REPLACE VIEW pinnacle_student
    AS
    SELECT DISTINCT p.person_identifier01,
    p.last_name,
    p.first_name,
    p.middle_name,
    p.date_of_birth,
    p.gender,
    a.line1 &#0124; &#0124; ' ' &#0124; &#0124; a.line2 &#0124; &#0124; ' ' &#0124; &#0124; a.line3 AS StreetAddress,
    a.city,
    a.state,
    a.zip,
    ph.phone_number,
    p.email,
    p.ssn,
    p.ethnic,
    p.fulltime,
    i.student_instance_id,
    e.comb_id
    FROM sss_student_enrollments e,
    sss_student_instance i,
    cmn_people p,
    cmn_people_addresses a,
    cmn_phone_nos ph,
    cmn_statuses s
    WHERE e.person_id = i.person_id
    and i.person_id = p.person_id
    and i.status_id = s.status_id
    and p.person_id = a.person_id(+)
    and p.person_id = ph.person_id(+)
    and s.status in ('Active', 'Accepted')
    and a.Active_Address(+) = 'Y'
    and a.Address_Type(+) = 'Home'
    and ph.active_phone_number(+) = 'Y'
    and ph.primary_flag(+) = 'Y';
    null

  • Multiple terminal windows on multiple views in Subtle WM?

    Apologies if this has already been answered somewhere, but I couldn't find it.
    I'm using the Subtle WM, and I really love it's use of gravities and tags to position windows. The only problem I've run into is when I have multiple copies of the same program/window open, and want them placed on different views.
    If I have urxvt tagged to go to a particular view, then all of my urxvt terminal windows will open on that view. But I often like to have terminals open on different views for different purposes, depending on what I'm doing in that view.
    I tried tagging urxvt on multiple views, but that didn't work. Is there a way to accomplish this in Subtle?

    I've never used subtle, but I suspect it identifies client windows (for putting them on selected tags) by their resource name/class.  You can easily set these when you start urxvt (e.g. with the -name flag) so you can have different resource names for different urxvt windows.

  • How to share a bind variable across multiple view objects?

    Hi, Can someone tell me if it's possible to share a bind variable among multiple view objects within an application module? My web page displays data from different VOs on different regions. But all data should be controlled by the same bind variable, which appears in all queries. How can I achieve this?
    Please help.

    Best to state your JDev version, and technology stack (eg. ADF BC) when posting.
    I can think of 2 approaches.
    1) Create a parent VO based on SELECT :bindVar FROM dual, then create links between your other VOs and the parent
    2) Create a AM client interface method that programatically sets the bind variable in each VO.
    Can you specify your use case? This one tends to come up when discussing effective from/to dated queries.
    CM.

  • Run SQL statements from a textbox

    Hi
    I'm trying to execute multiple insert/update or Delete statements from a textarea of a page. I'm basically trying to replicate the same functionalility as SQL Workshop for users to access and run sql statements for it.
    I know in SQL workshop you can run multiple insert/update or delete statements using the following syntax:
    begin
    insert into table_1 (col1,col2)values('WER','QWE');
    Insert into table_1 (col1,col2)values('ABC','DEF');
    End;
    I have created a textarea called :P1_SQL with a submit button which when pressed it runs the execute immediate :P1_SQL. It works if its a single insert command. I've tried the begin...end option which bring up the following error message:
    ORA-06550: line 1, column 6: PLS-00103: Encountered the symbol "" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe The symbol "begin was inserted before "" to
    Any ideas how I could get this to work?
    Message was edited by:
    Funkymonkey2

    The process code that I have is as follows:
    Declare
    l_sql varchar2 (4000);
    begin
    l_sql := :P3_SQL;
    execute immediate l_sql;
    End;
    in the textarea I had entered the following
    begin
    insert into TBL_TEST_SQL(name,useR_id)values('abc','erf' );
    insert into TBL_TEST_SQL(name,useR_id)values('dec','erf');
    end;
    I was actually hoping to concatanate the 'begin...' part and the 'end;/' part on to the beginning and end of the sql statements.
    Any ideas??

  • If statement within a view is not working correctly ?

    Hi all,
    maybe i am wrong but i think the if statement within a view is not working correctly. See code down below.
    I would like to use the Hallo World depending on the page attribute isFrame with or without all the neccessary html tags. Therefore i have embedded the htmlb tags in an if statement. But for any reason if isframe is initial it isn't working. It would be great if anybody could help me.
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <% if not isframe is initial. %>
      <htmlb:content design="design2003">
         <htmlb:page title = "Top Level Navigation view">
    <% endif. %>
    hallo world
    <% if not isframe is initial. %>
         </htmlb:page>
      </htmlb:content>
    <% endif. %>
    thanks in advance and best regards
    Matthias Hlubek

    Matthias,
    The short answer: your example is <b>NOT</b> going to work. The long answer will probably 5 pages to describe. So first let me rewrite the example so that it could work, and then give a short version of the long answer. Do not be disappointed if it is not totally clear. It is rather complicated. (See the nice form of IF statements that are possible since 620.)
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <% if isframe is <b>NOT</b> initial. %>
    <htmlb:content design="design2003">
      <htmlb:page title = "Top Level Navigation view">
        hallo world
      </htmlb:page>
    </htmlb:content>
    <% else. %>
      hallo world
    <% endif. %>
    So why does your example not work? Let us start with a simple tag:
      <htmlb:page title = "Top Level Navigation view">
      </htmlb:page>
    Now, for each tag, we have effectively the opening part (<htmlb:page>), an optional body, and then the closing part (</htmlb:page>). We are now at the level of the BSP runtime processing one tag. What the runtime does not know, is whether the tag wants to process its body or not. Each tag can decide dynamically at runtime whether the body should be processed. So the BSP compiler generates the following code:
      DATA: tag TYPE REF TO cl_htmlb_page.
      CREATE OBJECT tag.
      tag->title = 'Top Level Navigation view'.
      IF tag->DO_AT_BEGINNING( ) = CONTINUE.
      ENDIF.
      tag->DO_AT_END( ).
    You should actually just debug your BSP code at ABAP level, and then you will immediately see all of this. Now, let us mix in your example with our code generation. First you simplified example:
    <% if isframe is NOT initial. %>
      <htmlb:page title = "Top Level Navigation view">
    <% endif. %>
    <% if isframe is NOT initial. %>
      </htmlb:page>
    <% endif. %>
    And then with our generated code. Look specifically at how the IF/ENDIF blocks suddenly match!
    if isframe is NOT initial.
      DATA: tag TYPE REF TO cl_htmlb_page.
      CREATE OBJECT tag.
      tag->title = 'Top Level Navigation view'.
      IF tag->DO_AT_BEGINNING( ) = CONTINUE.
    endif.
    if isframe is NOT initial.
      ENDIF.
      tag->DO_AT_END( ).
    endif.
    You can see that your ENDIF statements are closing IF blocks generated by the BSP compiler. Such a nesting will not work. This is a very short form of the problem, there are a number of variations, and different types of the same problem.
    The only way to solve this problem, is probably to put the body into a page fragment and include it like I did above with the duplicate HelloWorld strings. But this duplicates source code. Better is to put body onto a view, that can be processed as required.
    brian

Maybe you are looking for