Apex Administration Service as Select Statement

Hi there,
I just wanted to check the "page views by user" and the "page views by application" for the last 2 years via the Apex Administration Tool, but I saw that it is restricted to maximum 1 year (Apex Version 1.6.0.00.87).
Can someone tell me the Select Statements that are fired by these requests so that I can modify them an run it e.g. via SQL-Workshop in my Workspace?
Would be of great help.
Thank you!
Johnny

Johnny,
The logs switch after 14 days (loosely speaking), so you get 28 days of logging on a system with continuous activity.
You can copy these records periodically for archival from the view apex_activity_log (wwv_flow_activity_log in 1.6) and you can write your own reports against that data, of course.
Scott

Similar Messages

  • Calculation using multiple select statements - APEX 4.0

    Hello,
    I am new to APEX, PL/SQL and have some SQL knowledge, but I pick up things quickly. I want to make a page item equal to the value of a Select statement minus another Select statement. The statements pull from the same tables and only differ slightly in the where clause. I do not know the best way to create this calculation. Can someone please assist.
    Select Statement #1
    select     sum(JE_TRANSACTIONS.DEBIT_AMOUNT) as "Release"
    from     "REVREC_FORMS" "REVREC_FORMS",
         "JOURNAL_ENTRIES" "JOURNAL_ENTRIES",
         "JE_TRANSACTIONS" "JE_TRANSACTIONS"
    where "JOURNAL_ENTRIES"."RELATED_REVREC"="REVREC_FORMS"."REVREC_ID"
    and     "JOURNAL_ENTRIES"."RECORD_ID_"="JE_TRANSACTIONS"."RELATED_JOURNAL_ENTRY"
    and      "JOURNAL_ENTRIES"."RELEASE_TYPE" ='Release'
    and     "JOURNAL_ENTRIES"."REVENUE_TYPE" ='Software'
    and     "REVREC_FORMS"."REVREC_ID" =:P12_REVREC_ID
    Select Statement #2
    select     sum(JE_TRANSACTIONS.DEBIT_AMOUNT) as "Deferral"
    from     "REVREC_FORMS" "REVREC_FORMS",
         "JOURNAL_ENTRIES" "JOURNAL_ENTRIES",
         "JE_TRANSACTIONS" "JE_TRANSACTIONS"
    where "JOURNAL_ENTRIES"."RELATED_REVREC"="REVREC_FORMS"."REVREC_ID"
    and     "JOURNAL_ENTRIES"."RECORD_ID_"="JE_TRANSACTIONS"."RELATED_JOURNAL_ENTRY"
    and      "JOURNAL_ENTRIES"."RELEASE_TYPE" ='Deferral'
    and     "JOURNAL_ENTRIES"."REVENUE_TYPE" ='Software'
    and     "REVREC_FORMS"."REVREC_ID" =:P12_REVREC_ID

    How about
    select   sum(decode(release_type,'Deferral',je_transactions.debit_amount)) - sum(decode(release_type,'Release',je_transactions.debit_amount)) as result
    from   "REVREC_FORMS" "REVREC_FORMS",
    "JOURNAL_ENTRIES" "JOURNAL_ENTRIES",
    "JE_TRANSACTIONS" "JE_TRANSACTIONS"
    where "JOURNAL_ENTRIES"."RELATED_REVREC"="REVREC_FORMS"."REVREC_ID"
    and  "JOURNAL_ENTRIES"."RECORD_ID_"="JE_TRANSACTIONS"."RELATED_JOURNAL_ENTRY"
    and  "JOURNAL_ENTRIES"."REVENUE_TYPE" ='Software'
    and  "REVREC_FORMS"."REVREC_ID" =:P12_REVREC_IDScott

  • Apex v4 - Trouble connect to administrative services

    I installed Oracle 11gr1 and followed the install and post install instructs properly ... or so I believe.
    I ran the Apex sql verification script and it returned 'VALID'.
    I ran the script to return the http port and it returned 8080 as the default port.
    OEM shows that the user accounts appear correct and that they are unlocked as mentioned in the documentation.
    When I open a browser and try to run administrative services for Apex, I get a series of
    Network Error - 404 messages.
    11g has been loaded on our server cwtk7b1 which is a virtual server.
    Any ideas or suggestions would be appreciated.
    Thanks,
    Ron Walker
    [email protected]

    RonW,
    I think you have to choose which web access you'd like to use. Either using APEX listener or OHS, you will be required to setup or use the web server (likely on a separate system from database system). If using embedded PL/SQL gateway (EPG) which already comes with 11g, you don't need a separate server. Also this begs a question whether or not this is for testing or production deployment. If it is for production, I'd recommend using APEX listener or OHS.
    For OHS option as you stated, the /i/ is the image location on the web server specified in the dads.conf (which is on web server). If you just follow the instructions in the APEX installation document, there will be sections to configure dads.conf and copy image files to web server.

  • Unable Logging in to Oracle Application Express Administration Services

    I am new for DB. Installed Oracle XE, followed the instruction "Logging in to Oracle Application Express Administration Services", I can not find the login page:
    http://127.0.0.1:7777/pls/apex/apex_admin
    I work on the PC in which XE installed.
    Where are these two files
    ORACLE_BASE\ORACLE_HOME\install\portlist.ini
    ORACLE_BASE\ORACLE_HOME\Apache\Apache\conf\httpd.conf
    I did a search, can't find them.
    Any help welcome.
    Thanks.

    The default port for the Apex webserver is 8080, not 7777.
    To access the XE Database GUI from the Start menu, select Programs (or All Programs), then Oracle Database 10g Express Edition, and then Go to Database Home Page. (I'm assuming your on Windows)
    Or try: http://localhost:8080/apex in your browser.
    The files you mention relate to Apache web server. Oracle XE does not include a Apache, it's web server is built into the database. Are you sure you're following the right documentation? See http://www.oracle.com/pls/xe102/homepage
    Hope this helps.

  • Apex_util.prepare_url within a select statement

    APEX Version: 3.1.2.00.02
    Need help with embedding APEX_UTIL.PREPARE_URL in select statement. Unable to reference column name as a bind variable...or it allows as in code below, but no values are included in the URL. Using PREPARE_URL so checksum is created.
    URL created:*
    https://.../f?p=108:90:623968923157010::NO::P90_RID:&cs=3CB12F3B467B3989B51377487817BDB08
    Note: href >> replaced with >> hrf
    declare
       q           varchar2(32767);      -- query
       w           varchar2(4000) ;      -- where clause
       we          varchar2(1) := 'N';  -- identifies if where clause exists
    begin
       q :=  'select "RID", '||
             '       "EMPLOYEE_NO", '||
             '       InitCap(first_name)||
             '||''' '''||
             '||InitCap(last_name) as "Name", '||
             '       "HIRE_DATE", '||
             '       "JOB_TITLE", '||
             '       CASE '||
             '          WHEN CORRECTION_IND = 'X' '||
             '             THEN ''<a hrf="' ||
    apex_util.prepare_url('f?p='||:APP_ID||':90:'||:APP_SESSION||'::'||:DEBUG||'::P90_RID:'||:RID) ||
             '">Correction</a>'' '  ||
             '          ELSE    NULL '||  
             '       END CORRECTED '||
             '  from "#OWNER#"."EMPLOYEE_TABLE" ';
       if :P28_FIRST_NAME IS NOT NULL
          then
             w := w || ' AND first_name LIKE UPPER(:P28_FIRST_NAME||'||'''%''' ||')' ;
             we := 'Y';
       end if;
       if :P28_LAST_NAME IS NOT NULL
          then
             w := w || ' AND last_name LIKE UPPER(:P28_LAST_NAME||'||'''%''' ||')' ;
             we := 'Y';
       end if;
       if we = 'Y'
          then q := q || w;
       end if;
    return q;
    end;Edited by: JSandoval on May 25, 2011 1:03 PM

    I think that the problem is that the function apex_util.prepare_url is executed building the "q" variable, not during query execution. (you have to try to quote it ...)
    I often use the "Query from function".
    There a couple of things that helps me:
    - I always put in the page an item PXX_SHOW_SQL(checkbox) visible only to administrator (a user setting in my application...).
    Before the "return q" put a htp.p(q) if this Item is not null. So you can see the actual SQL (often helps reformattig the output with SqlDeveloper)
    - I'm became crasy tring to quote complex query ... Now I write the query code in a TABLE
    Example AUXSQL(APP_ID number,APP_PAGE number, PRG number, sql VARCHAR2(4000))
    More "PRG" if more than 4000 chars. (I start in this way, but someone use CBLOB ...)
    I find this very usefully!!
    Thanks
    Stefano Corradi

  • Is there any  way to Mask the Name when  a select statement is issued?

    Dear all,
    Is there any way to mask the name .. i mean if User issue a select statement in a customer table the real name should come like ' ABCXXXDEFXXCFXX'... Which is not the actual name?
    e.g if Name: CHIEV SONG MEE
    If user issue a statment select * from customers;
    The Result Should come something Like this:
    Name
    CHXXV SXNG MXX
    Thank You

    user3029023 wrote:
    but it seems there is no option in oracle it self which can be used as there they are saying to get a data masking software which we can't due to some internal issues....I would not say that. How one implements masking depends entirely on the requirements that need to be met.
    For example, schema A owns all the tables. Schema B can be created as a "trusted" schema - in other words, schema A trusts schema B and allows it full access (with grants) to its tables. Schema B implements data masking as views. For each table in A, a view exists in B that implements the required masking. B can now grant select access on these views to user C. User C will see the same data object names in B as it would have if it used A - only, by using the B data objects it uses masked data objects and not the original source data objects.
    Another example - schema Dev is to have all the data objects of schema Prod, but masked where needed. One can use CTAS (Create Table As Select) to create the required tables in Dev with masked values where relevant. This Dev schema can be "refreshed" on weekends by dropping all tables and getting a new fresh copy of production data and masking it - ready for the next week's development cycle.
    If the application use is for example APEX, then instead of coding SQL directly as reporting regions to display, a function is used instead. APEX supports reporting regions where it calls a function and this function provides the APEX run-time with the SQL to execute and contents to render. It is easy to use this approach to implement logic in functions that masked column data depending on who the APEX user is, the security/role attributes of the user, and so on.
    No there is not a single "+mask this column!+" feature in Oracle.. but that does not mean that such a feature is not supported and cannot be implemented. Oracle has a very comprehensive and rich set of tools - more so than most (if not all) other RDBMS products.
    It is up to the architect/designer/developer to use this toolkit in creating a system that meets the specific requirements at hand.

  • SELECT statement in stored procedure

    I want to be able to execute a simple SELECT statement from within a stored procedure and return a stream of data which consists of all the rows from the SELECT statement.
    Ultimately, I want to ouput this stream of data to a Crystal Report.
    Apparently, Oracle will not allow you to execute a simple SELECT statement from within a stored procedure. It will only allow execution of a SELECT INTO statment, which requires that you define a cursor, etc. etc.
    Any way around this?
    Thanks
    Bill

    Look into REF CURSORs. Still not sure about whether APEX uses them though.... Good luck.

  • How to use bind variable value for table name in select statement.

    Hi everyone,
    I am having tough time to use value of bind variable for table name in select statement. I tried &p37_table_name. ,
    :p37_table_name or v('p37_table_name) but none worked.
    Following is the sql for interactive report:
    select * from v('p37_table_name') where key_loc = :P37_KEY_LOC and
    to_char(inspection_dte,'mm/dd/yyyy') = :P37_INSP_DT AND :p37_column_name is not null ;
    I am setting value of p37_table_name in previous page which is atm_state_day_insp.
    Following is error msg:
    "Query cannot be parsed, please check the syntax of your query. (ORA-00933: SQL command not properly ended) "
    Any help would be higly appreciated.
    Raj

    Interestingly enough I always had the same impression that you had to use a function to do this but found out from someone else that all you need to do is change the radio button from Use Query-Specific Column Names and Validate Query to Use Generic Column Names (parse query at runtime only). Apex will substitute your bind variable for you at run-time (something you can't normally do in pl/sql without using dynamic sql)

  • Auto retry of select statements on failure

    I have a IBM Message Broker message flow that accesses the database to fetch some data. following are the steps in a message flow. (similar pattern is there in other flows as well)
    1) Parse the input message
    2) Invoke a ESQL compute node that accesses the database. This uses DataDirect ODBC drivers to access the database.
    3) process the data
    4) Invoke an external Java class that also accesses the database. This Java class uses Spring/Hibernate and uses the Oracle UCP library.
    Steps 2 and 4 access an Oracle database on which failover features are NOT enabled. Following is our observation.
    If the database fails when executing step 2, then the message flow pauses until a valid connection is available and then proceeds with the execution, the point to note is that the message flow does not experience a failure. It simply pauses until it gets a connection and continues once it gets a connection.
    If the database fails when executing step 4, the message flow gets an error.
    What we want is for step 2 and 4 to execute the same way, meaning that we want the message flows to wait until a valid connection is available and then continue without any errors.
    I feel that there is some feature in DataDirect driver that cause step 2 to pause the message flow and prevent an error. We want the same behaviour in step 4 as well.
    So, is there some way (via configuration or any other means) to get this behaviour using oracle UCP library.
    One thing to note is that we are not in position to change the Java code since it has been developed by a third party.
    To achieve this I have written a test and the following are details.
    For this I have created a service with the following properties. Point to note is that we run the service on only one instance at a time, if it goes down then it is started on the second instance.
    Service name: LDL_TEST02
    Service is enabled
    Server pool: CSAHEDA_LDL_TEST02
    Cardinality: 1
    Disconnect: false
    Service role: PRIMARY
    Management policy: AUTOMATIC
    DTP transaction: false
    AQ HA notifications: true
    Failover type: SELECT
    Failover method: NONE
    TAF failover retries: 180
    TAF failover delay: 5
    Connection Load Balancing Goal: LONG
    Runtime Load Balancing Goal: NONE
    TAF policy specification: BASIC
    Edition:
    Preferred instances: CSAHEDA1
    Available instances: CSAHEDA2
    Following is in my tnsnames.ora file and I am using the oracle oci driver.
    TESTA =
    (DESCRIPTION =
    (ENABLE = BROKEN)
    (LOAD_BALANCE = off)
    (FAILOVER = on)
         (ADDRESS_LIST =
         (ADDRESS = (PROTOCOL = TCP)(HOST = vip.host1)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = vip.host2)(PORT = 1521)))
    (CONNECT_DATA =
    (SERVICE_NAME = LDL_TEST02)
    (FAILOVER_MODE =
    (BACKUP = TESTA2)
    (TYPE = SELECT)
    (METHOD = PRECONNECT)
    (RETRIES = 120)
    (DELAY = 5)
    This is how I run my test.
    1)I have a simple test that simply loops through a list of select statements.
    2)each time it takes a connection from the connection pool, executes the statement and returns the connection to the connection pool.
    3)I keep this running for around 10 minutes.
    4) once the test has started I bring down the service wait for 3 minutes and the start the service on the second instance.
    5) what I expect is for the test to pause for 3 minutes and then get the correct value from executing the select statement. and continue without pause.
    Following is the config for the connection pool.
         <bean id="dd_Datasource" class="oracle.ucp.jdbc.PoolDataSourceFactory" factory-method="getPoolDataSource">
              <property name="connectionFactoryClassName" value="oracle.jdbc.xa.client.OracleXADataSource"/>
              <!-- property name="connectionFactoryClassName" value="oracle.jdbc.pool.OracleDataSource"/ -->
              <!-- <property name="connectionFactoryClassName" value="sun.jdbc.odbc.ee.DataSource"/-->
              <!-- <property name="URL" value="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vip.host1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vip.host2)(PORT=1521))(LOAD_BALANCE=yes)(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=LDL_TEST02)))" /> -->
              <!-- <property name="URL" value="jdbc:oracle:thin:@(DESCRIPTION=(ENABLE=BROKEN)(ADDRESS=(PROTOCOL=TCP)(HOST=vip.host1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vip.host2)(PORT=1521))(LOAD_BALANCE=yes)(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=LDL_TEST02)))" />-->
              <!-- property name="URL" value="jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(FAILOVER=on)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=vip.host1) (PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vip.host2) (PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=LDL_TEST02)(FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5))))" /-->
              <!-- <property name="URL" value="jdbc:oracle:oci:@(DESCRIPTION=(ENABLE=BROKEN)(ADDRESS_LIST=(LOAD_BALANCE=on)(FAILOVER=on)(ADDRESS=(PROTOCOL=TCP)(HOST=vip.host1) (PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vip.host2) (PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=LDL_TEST01)(FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5))))" /> -->
              <property name="URL" value="jdbc:oracle:oci:/@TESTA" />
              <!-- JDBC ODBC Bridge Driver -->
              <!-- property name="URL" value="jdbc:odbc:LT_Test_DB"/-->
              <!-- DataDirect URLs -->
              <!-- property name="URL" value="datadirect:oracle://vip.host1:1521;SID=LDL_TEST01"/-->
              <property name="user" value="user" />
              <property name="password" value="user" />     
              <property name="connectionPoolName" value="dd_connectionpool" />
              <property name="minPoolSize" value="2" />
              <property name="maxPoolSize" value="4" />                     
              <property name="initialPoolSize" value="2" />
              <property name="connectionWaitTimeout" value="10000" />
              <!-- Note:
                   The setSQLForValidateConnection property is not recommended when using an Oracle JDBC driver.
                   UCP for JDBC performs an internal ping when using an Oracle JDBC driver.
                   The mechanism is faster than executing an SQL statement and is overridden if this property is set.
                   Instead, set the setValidateConnectionOnBorrow property to true and do not
                   include the setSQLForValidateConnection property. -->
              <property name="validateConnectionOnBorrow" value="true"/>
              <!-- FCF stuff -->
              <!-- property name="connectionCachingEnabled" value="true"/-->
              <!-- property name="fastConnectionFailoverEnabled" value="true"/-->
              <!-- <property name="ONSConfiguration" value="nodes=vip.host1:1521,vip.host2:1521"/>-->
         </bean>     
    As you can see I have tried many combinations.
    Sometimes I see the thread pause for 3 minutes without error and then continue.
    Sometime I start seeing 'oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource' as soon as the servic is down.
    Sometime the first error above is seen after 30 seconds (always the first one).
    Can you guys shed any light on this? And how can I get the desired behaviour?
    Edited by: user12181209 on 30-May-2012 02:22
    reworded.
    Edited by: user12181209 on May 30, 2012 6:28 AM
    reworded the title for clarity.
    Edited by: user12181209 on Jun 1, 2012 6:01 AM

    Hi,
    Yesterday, a similar question on running slow view was post :
    View is tooo slow....
    You can read different questions to try to help you.
    Nicolas.

  • Regarding Logical database and  select statement..

    Hi
    Experts.
    i would  like to  know the  diff b/w logical data base & select statement  while using report.
    wt is the use of logical databases in R/3. is there   any   advantage  used in the  reports.
    Thanks & Regards..
    Spandana.

    Dear Spandana,
      Go through the below description of LDB. I hope you wil get a fair amount of idea.
    SAP comes loaded with all the extras. Among the extras that are most helpful to IT managers are all the access routines needed to pull any business object that managers can think of out of SAP databases. However, SAP has not thought of everything where your particular applications are concerned. SAP organizes its standard database tables to service business units based on conventional business applications. Itu2019s likely your business requires something new, perhaps even something exotic. In that case, you will need to create a new database, using information from different places. Basically, you need a logical database. You need to create a virtual business data object repository consisting of a new kind of record or table that suits your purposes. In addition, the repository should be composed of information that is actually stored in a number of different locations, none of them necessarily logically associated with one another. Letu2019s take a closer look at creating logical databases.
    A case for a logical database
    Suppose my company manufactures widgets of the most obscure variety, and they are components of other widgets. I sell my widgets as raw material for the more sophisticated widgets built by others, but in some cases I actually partner with other manufacturers in creating yet another class of widget. Now, in my world, I consequently have customers who are also partners. I sell to them and I partner with them in manufacturing and distribution. Also, I need an application that uses both of these dual-use relationships.
    Essentially, I have a customer database and a partner database. Neither contains records that are structured to contain the identifying particulars of the other. Thus, I need a hybrid database that gives me tables detailing these hybrid relationships. What can I do? I can go the long way around and write a new database, pulling information from both and creating new objects with a customized program that I write by hand. However, this process is cumbersome and contains maintenance issues. On the other hand, I can use SAPu2019s logical database facility, create my logical database in a couple of minutes, and have no maintenance issues at all.
    Logical database structures
    There are three defining entities in an SAP logical database. You must be clear on all three in order to create and use one.
    u2022     Table structure: Your logical database includes data from specified tables in SAP. There is a hierarchy among these tables defined by their foreign keys (all known to SAP), and you are going to define a customized relationship between select tables. This structure is unique and must be defined and saved.
    u2022     Data selection: You may not want or need every item in the referenced tables that contributes to your customized database. There is a selection screen that permits you to pick and choose.
    u2022     Database access programming: Once youu2019ve defined your logical database, SAP will generate the access subroutines needed to pull the data in the way you want it pulled.
    Creating your own logical database
    ABAP/4 (Advanced Business Application Programming language, version 4) is the language created by SAP for implementation and customization of its R/3 system. ABAP/4 comes loaded with many predefined logical databases that can construct and table just about any conventional business objects you might need in any canned SAP application. However, you can also create your own logical databases to construct any custom objects you care to define, as your application requires in ABAP/4. Hereu2019s a step-by-step guide:
    1.     Call up transaction SLDB (or transaction SE36). The path you want is Tools | ABAP Workbench | Development | Programming Environment | Logical Databases. This screen is called Logical Database Builder.
    2.     Enter an appropriate name in the logical database name field. You have three options on this screen: Create, Display, and Change. Choose Create.
    3.     Youu2019ll be prompted for a short text description of your new logical database. Enter one. Youu2019ll then be prompted to specify a development class.
    4.     Now comes the fun part! You must specify a root node, or a parent table, as the basis of your logical database structure. You can now place subsequent tables under the root table as needed to assemble the data object you want. You can access this tree from this point forward, to add additional tables, by selecting that root node and following the path Edit | Node | Create. Once youu2019ve saved the structure you define in this step, the system will generate the programming necessary to access your logical database. The best part is you donu2019t have to write a single line of code.
    Watch out!
    The use of very large tables will degrade the performance of a logical database, so be aware of that trade-off. Remember that some tables in SAP are very complex, so they will be problematic in any user-defined logical database.
    Declaring a logical database
    Hereu2019s another surprising feature of logical databases: You do not assign them in your ABAP/4 Code. Instead, the system requires that you specify logical databases as attributes. So when you are creating a report, have your logical database identifier (the name you gave it) on hand when you are defining its attributes on the Program Attributes screen. The Attributes section of the screen (the lower half) will include a Logical database field, where you can declare your logical database.
    Logical databases for increasing efficiency
    Why else would you want to create a logical database? Consider that the logical databases already available to you begin with a root node and proceed downward from there. If the data object you wish to construct consists of items that are all below the root node, you can use an existing logical database program to extract the data, then trim away what you donu2019t want using SELECT statementsu2014or you can increase the speed of the logical database program considerably by redefining the logical database for your object and starting with a table down in the chain. Either way, youu2019ll eliminate a great deal of overhead.
    Regards
    Arindam

  • Use of wildcard * in SELECT statement

    I have read that the use of the wildcard * in a SELECT statement cannot be utilized when using the INSERT INTO or other queries where data column/field alignment is critical. I have noted that the INSERT INTO column/fields must be in the same order
    as the SELECT statement (as there is no alignment to column/field names). Can someone please provide me with the information or article that covered this scenario?

    It is consider a good practice to specify columns name, however , SQL Server is smart enough to insert the data without too , but only if the table does not have an IDENTITY property
    CREATE TABLE #t (c1 int, c2 char(1),c3 real, c4 bit)
    CREATE TABLE #t1 (c1 int, c2 char(1),c3 real, c4 bit)
    ---Same thing with INSERT  like SELECT * you asked
    INSERT INTO #t1 VALUES (1,'A',2.5,0) 
    INSERT INTO #t1 VALUES (2,'B',3.5,1)
    INSERT INTO #t1 VALUES (3,'C',4.5,0)
    INSERT INTO #t SELECT * FROM #t1
    SELECT * FROM #t
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Problems with Hints in abap code to use an index in a Select statement

    Hi,
    I want to use an especific index in a select statement but I can´t get it. I use de next statement:
    SELECT ltaklgnum ltaktanum ltakvbeln ltaptapos ltapnltyp ltappvqui
           FROM ltak AS ltak INNER JOIN ltap AS ltap
                            ON  ltaktanum = ltaptanum
                            AND ltaklgnum = ltaplgnum
           INTO TABLE l_t_tanum_silo
           WHERE ltap~lgnum EQ ip_lgnum
             AND ltap~pquit EQ ' '
             AND ltak~lgnum EQ ip_lgnum
             AND ltak~kquit EQ ' '
             AND ltak~queue EQ ip_queue
             %_HINTS DB2 ''.
    We have DB2 for Linux Unix and Windows 9.5 as DB system.
    How can I fix this?
    Thanks a lot.
    Regards

    The DB2 for Linux Unix and Windows is coded DB6 for SAP and not DB2
    Look at the following OSS notes
    - [Note 129385 - Database hints in Open SQL|https://service.sap.com/sap/support/notes/129385]
    - [Note 150037 - Database hints in Open SQL for DB6 (DB2 for LUW)|https://service.sap.com/sap/support/notes/150037]
    - [Note 1270314 - DB6: DB2 9.5 Perf. degrad. for queries with INLIST clause|https://service.sap.com/sap/support/notes/1270314]
    - [Note 868888 - DB6: Optimization Guidelines|https://service.sap.com/sap/support/notes/868888]
    You should use a
    SELECT ltak~lgnum ltak~tanum ltak~vbeln ltap~tapos ltap~nltyp ltap~pvqui
      FROM ltak AS ltak INNER JOIN ltap AS ltap
      ON ltak~tanum = ltap~tanum
        AND ltak~lgnum = ltap~lgnum
      INTO TABLE l_t_tanum_silo
      WHERE ltap~lgnum EQ ip_lgnum
        AND ltap~pquit EQ ' '
        AND ltak~lgnum EQ ip_lgnum
        AND ltak~kquit EQ ' '
        AND ltak~queue EQ ip_queue
      %_HINTS DB6 '<IXSCAN TABLE=''LTAP'' INDEX=''"LTAP~M"'' />'.
    In note 868888 there is a sample for a join.
    SELECT A~TABSPACE
    FROM TADB6 AS A
    JOIN IADB6 AS B ON A~TABART = B~TABART
    %_HINTS DB6 '<NLJOIN><IXSCAN TABLE=''IADB6'' />'
            DB6 '<IXSCAN TABLE=''TADB6'' /></NLJOIN>'.
    Regards

  • Edit an object's select statement of OLAP universe SAP BW

    Hi everybody
    I am new at working with Olap Universes BW, and I have to edit one universe SAP BW, I don't know if I can to use substring function on a select statement, for example  substring([0D_DIV].[LEVEL01],5,5), I try to use this function but I have a error,
    Could you help me? I need to returns part of a string, is correct to do it on a universe or is better to do at BW.

    Hi,
    First of all I recommend you read the documentation that gives you information about OLAP universes and especially SAP BW universes.
    I also recommend to download documents related to SAP universes deployment, administration and customization:
    [OLAP Universes - how to samples and recommendations |https://wiki.wdf.sap.corp/wiki/display/globalregions/OLAPUniverses-howtosamplesand+recommendations]
    [SAP Integration |https://wiki.wdf.sap.corp/wiki/display/globalregions/SAP+Integration]
    Now you can customize expression using MDX in OLAP universes. MDX expressions must be enclosed with <EXPRESSION></EXPRESSION> XML tags.
    Unfortunately SAP BW MDX does not support calculations that return string or date values.
    The onlyway to return string is to use NAME or UNOIQUENAME attribute.
    See answers I already in the forum: [Forum answer |Re: Create new dimension on top of SAP BW data]
    Regards
    Didier

  • How to use a select statement with chinese characters?

    I am currently developing a java servlet<using tomcat 4.x> which allows me to use select statement to retrieve results from the Microsoft SQL Server 2000 database. I am using a simple form to get the parameter for querying. The main problem i'm facing is that there are chinese information in the SQL database, but i can't retrieve it through the sql statement with the chinese characters input<thru the form with the help of NJ STAR>in the WHERE condition. When i execute the statement, it returns me no results even though the rows are present in the database.
    Does anyone have the solution to using chinese words in the WHERE clause of the select statement to retrieve results with columns which contains chinese characters? Please help me. Thanks everyone. :)
    PS: when i cut and paste those characters in the sql database and paste onto java.. it is ??? in questionmarks.. but when i paste them into excel 2000.. its shown as chinese chars again..
    please heelppp~~

    Greetings,
    PS: when i cut and paste those characters in thesql
    database and paste onto java.. it is ??? in
    questionmarks.. but when i paste them into excelThis is why the SELECT is not returning any results.
    You need to set the character encoding set on your
    statement and parameters for the characters to be
    properly translated. Refer to the charsetName
    parameter in the String class constructor in your API
    docs and also to
    $JDK_DOCS/guide/intl/encoding.doc.html in your JDK
    documentation.
    2000.. its shown as chinese chars again..Because Office programs are performing the same kind
    of character translation with the appropriate MS APIs.
    please heelppp~~Regards,
    Tony "Vee Schade" Cookis it possible for you to show me some coding examples? i don't really understand what is to be done in order to set the char set and what does it really do.. tried reading up but still dun understand.. :(
    pardon my shallow knowledge of java..
    ok..
    The thing is when i used an insert statement with chinese characters of GBK format hardcoded into the java servlet and then i use the insert statement to insert the chars into the database, it cannot be seen as a chinese word when i off the NJStar. and then it can be searched out with my current form of servlet.. below is my coding of the servlet..
    note: i've set my html file to charset = GBK
    //prototype of Search engine...
    //workable for GBK input and output...
    import java.io.*;
    import java.io.OutputStream;
    import java.io.IOException;
    import javax.servlet.http.*;
    import javax.servlet.ServletException;
    import java.util.*;
    import java.sql.*;
    import java.nio.charset.Charset;
    public class SearchBeta extends HttpServlet {
         private Vector musicDetails = new Vector();
         private String query = "";
         public void service (HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException, UnsupportedEncodingException {
              query = req.getParameter ("T1");
              System.out.println("before:"+query);
              String type = req.getParameter ("D1");//type
              query = req.getParameter ("T1");
              //query = "������";
              System.out.println("after:"+query);
              getResults(type,query);
              System.out.println("locale = :"+req.getLocale());
              res.setContentType ("text/html;charset=GBK");
              PrintWriter out = res.getWriter();
              out.println("<html>");
              out.println("<head>");
              out.println("<body bgcolor = \"black\">");
              out.println("<font face = \"comic sans ms\" color=\"Cornsilk\">");
              if (query.length()==0)
                   out.println ("Please key in your search query.");
              else if (musicDetails.size()==0)
                   out.println ("Sorry, no results matching your search can be found.");
              else {
                   out.println("<center>");
                   out.println("<table cellspacing = \"50\">");
                   int i = 0;
                   //Display the details of the music
                   while (i<musicDetails.size()) {
                        Results details = (Results)musicDetails.get(i);
                        String dbArtist = "";
                        String dbAlbum = "";
                        String dbTitle = "";
                        String dbCompany = "";
                        dbAlbum = details.getAlbum();
                        dbTitle = details.getTitle();
                        dbCompany = details.getCompany();
                        dbArtist = details.getArtist();
                        try{
                             dbAlbum = new String(dbAlbum.getBytes("ISO-8859-1"),"GBK");
                             dbTitle = new String(dbTitle.getBytes("ISO-8859-1"),"GBK");
                             dbCompany = new String(dbCompany.getBytes("ISO-8859-1"),"GBK");
                             dbArtist = new String(dbArtist.getBytes("ISO-8859-1"),"GBK");//correct translation.
                        catch(UnsupportedEncodingException e){
                             System.out.print(e);
                             e.printStackTrace();
                        String dbImage_loc = details.getImage();
                        out.println("<tr>");
                             out.println("<td><table>");
                                  out.println("<img src=C:\\Program Files\\Apache Group\\Tomcat 4.1\\webapps\\examples\\ThumbNails\\"+dbImage_loc+">");
                             out.println("<tr>");
                                  out.println("<th><font color=\"violet\"> Artist: </font></th>");
                                  out.println("<td><font color=\"Cornsilk\">"+dbArtist+"</font></td>");
                             out.println("</tr>");
                             out.println("<tr>");
                                  out.println("<th><font color=\"violet\"> Title: </font></th>");
                                  out.println("<td><font color=\"Cornsilk\">"+dbTitle+"</font></td>");
                             out.println("</tr>");
                             out.println("<tr>");
                                  out.println("<th><font color=\"violet\"> Company: </font></th>");
                                  out.println("<td><font color=\"Cornsilk\">"+dbCompany+"</font></td>");
                             out.println("</tr>");
                             System.out.println("album: "+ dbAlbum);
                             out.println("<tr>");
                                  out.println("<th><font color=\"violet\"> Album: </font></th>");
                                  out.println("<td><font color=\"Cornsilk\">"+dbAlbum+"</font></td>");
                             out.println("</tr>");
                             System.out.println("company: "+ dbCompany);
                             out.println("</table></td>");
                        out.println("</tr>");
                        i++;
                   out.println("</table>");
                   out.println("</center>");
              out.println("</font>");
              out.println("</body>");
              out.println("</head>");
              out.println("</html>");
              out.close();
              //to remove all the elements from the Vector
              musicDetails.removeAllElements();
         //get Searched Music Details and store in Results object which is stored in musicDetails vector
         public void getResults (String type, String searchQuery) {
              try {
                   Class.forName ("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                   Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=music","sa","kokkeng");
                   Statement stmt = con.createStatement();
                   String query = "SELECT * FROM MusicDetails WHERE "+type+" = '"+searchQuery+"'";
                   ResultSet rs = stmt.executeQuery(query);
                   while (rs.next()) {
                        String artist = rs.getString("Artist");
                        String title = rs.getString("Song");
                        String company = rs.getString("Company");
                        String album = rs.getString("Album");
                        String image_loc = rs.getString("Image");
                        Results details = new Results (artist,title,company,album,image_loc);
                        musicDetails.add(details);
                   stmt.close();
                   con.close();
              catch (Exception e) {
                   System.out.println(e.getMessage());
                   e.printStackTrace();
    with the above servlet i created, i can search out the data in the database which i've inserted through the insert statement. I still can't search for things i've keyed into the database directly using NJStar..
    thank you so much for helping.. really hope any one else who knows the answer to this will reply too... thank you all so much...
    -KK

  • Select a column from an inner select statement

    On my oracle 10g running on solaris, I am running this little query that gives me
    the right results (I needed one more column and not able to get to it, hence looking for some ideas here)
    Select a.othtype, a.date_from, a.date_to,b.process
    from bio_plan_other a,
    bio b,
    Where a.bkey = b.bkey
    and a.date_from <
    (Select min(f.edate)
    from bio_service f
    where f.bkey = a.bkey) ;
    In the inner select table bio_service, I have an additional column called service_name. Hence for the min(f.edate), there is a corresponding service_name.
    How do I get that service_name in my topmost SELECT statement ?
    In other words, I wanted to do something like...
    Select a.othtype, a.date_from, a.date_to,b.process,f.service_name
    from bio_plan_other a,
    bio b,
    Where a.bkey = b.bkey
    and a.date_from <
    (Select min(f.edate)
    from bio_service f
    where f.bkey = a.bkey) ;
    But this gives me,
    ORA-00904 : f.service_name : invalid identifier
    Thanks

    Hi
    Not knowing your datamodel, but you probably have more service names per date, so did you try this?
    WITH t_bio_service AS (SELECT b2.bkey, b2.min_edate, b.service_name
                             FROM bio_service b
                                , (SELECT MIN(edate) min_edate, bkey
                                     FROM bio_service
                                    GROUP BY bkey) b2
                            WHERE b2.bkey = b.bkey
                              AND b2.min_edate = b.edate)
    SELECT a.othtype, a.date_from, a.date_to,b.process, t.service_name
      FROM bio_plan_other a,
           bio b,
           t_bio_service t
    WHERE a.bkey = b.bkey
       AND t.BKEY = b.bkey
       AND a.date_from < t.min_edateHope this helps.
    Regards Auke

Maybe you are looking for

  • Get file from dms

    hi, can anyone help me to get the data for a file in dms with a specific doknr? i need to get the binary data to send them per mail. I searched in function group cv120 (i tried cv120_read_file2table but it doesn't work for me) but wasn't able find a

  • Pictures from iPhoto not showing up properly on iPhone 4s

    With my iphone 3G I wanted my photos organized into groups so I could look through specific photos rather than a cycling through ALL my images.  So I took some advice I found online and organized my photos into albums in iPhoto and had my iPhone sync

  • File name completion in Solaris 8 (SPARC)

    I am running Solaris 8 on an old SPARC-20 using the C shell. File name completion will not work for root or any other users. I have verified that all are setup with the C shell by using echo $SHELL. Other C shell features (aliases, command history, e

  • Event handlers inheritence

    Do You plan to add some inheritence into event handlers. Example: I have event defined in UIX page and i have same event registred at global level through PageBroker. Do You know how can I handle event with same name before globally defined?

  • TS3694 i can't restore my iphone 4..keep error 3194 can anyone help me out?

    i can't restore my iphone 4..keep error 3194 can anyone help me out?