ODT PL/SQL overloading subprogram names

Hi,
I'm new with ODT.
I'm trying to create a data set containing two queries to two overloaded sub programs of a package.
I have a schema with a table named INI_FILE and two packages INI_FILE_TP and INI_FILE_QP (See the code at the end of the mail).
INI_FILE_TP just defined several types and subtypes.
INI_FILE_QP contains three functions retrieving data from the table INI_FILE:
- all_rows_rc: return all rows using a reference cursor
- one_row_rc (name_in): return a row using a varchar2 as parameter
- one_row_rc (ini_file_id_in): return a row using a number as parameter
Under Visual studio using ODT, from the server explorer I can drag and drop the two functions one_row_rc.
Each one creating a new set of dataTable, Adapter and so on. It works fine.
Now, let's suppose I want to have only one data table containing my three functions as queries.
So I drag and drop the all_rows_rc function.
Then I add a query to that data table and choose stored procedure.
The wizard shows me all the function so I choose to add one_row_rc ( name_in ) then press finish.
The data table is updated and display the wrong function: It chose the one_rows_rc ( ini_file_id_in ) instead.
How can I fixed that?
I forgot to mention that I'm worknig with Visual Studio Pro Edition 2005
Cheers,
Sebastien
CREATE TABLE INI_FILE
INI_FILE_ID NUMBER(10) CONSTRAINT NN_INIFILE_INIFILEID NOT NULL,
NAME VARCHAR2(30 CHAR) CONSTRAINT NN_INIFILE_NAME NOT NULL,
DESCRIPTION VARCHAR2(200 CHAR),
CREATEDDATE TIMESTAMP(6) WITH TIME ZONE DEFAULT systimestamp,
UPDATEDDATE TIMESTAMP(6) WITH TIME ZONE,
CONSTRAINT PK_INIFILE
PRIMARY KEY
(INI_FILE_ID)
CREATE OR REPLACE PACKAGE ICIS_PRL.INI_FILE_TP
AS
NAME: INI_FILE_TP
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 09-Jan-2009 1. Created this package.
-- ROWTYPE declaration
SUBTYPE ini_file_rt IS INI_FILE%ROWTYPE;
-- SUBTYPE declarations
SUBTYPE ini_file_id_t IS INI_FILE.INI_FILE_ID%TYPE;
SUBTYPE name_t IS INI_FILE.NAME%TYPE;
SUBTYPE description_t IS INI_FILE.DESCRIPTION%TYPE;
-- REF CURSORS retruning a row
TYPE ini_file_rc IS REF CURSOR
RETURN ini_file%ROWTYPE;
END INI_FILE_TP;
CREATE OR REPLACE PACKAGE ICIS_PRL.INI_FILE_QP
AS
NAME: INI_FILE_qp
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 09-Jan-2009 1. Created this package.
-- Return a reference cursor for one row of data for a primary key
FUNCTION one_row_rc (ini_file_id_in IN INI_FILE_TP.INI_FILE_ID_T)
RETURN SYS_REFCURSOR;
-- Return a reference cursor for one row of data for a
FUNCTION one_row_rc (NAME_IN IN INI_FILE_TP.NAME_T)
RETURN SYS_REFCURSOR;
-- Return all rows in table via a reference cursor
FUNCTION all_rows_rc
RETURN SYS_REFCURSOR;
END INI_FILE_QP;
CREATE OR REPLACE PACKAGE BODY ICIS_PRL.INI_FILE_QP
AS
NAME: INI_FILE_qp
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 09-Jan-2009 1. Created this package.
-- Return a reference cursor for one row of data for a primary key
FUNCTION one_row_rc (ini_file_id_in IN INI_FILE_TP.INI_FILE_ID_T)
RETURN SYS_REFCURSOR
IS
retval INI_FILE_TP.INI_FILE_RC;
BEGIN
OPEN retval FOR
SELECT *
FROM INI_FILE
WHERE INI_FILE_ID = ini_file_id_in;
RETURN retval;
END;
-- Return a reference cursor for one row of data for a
FUNCTION one_row_rc (NAME_IN IN INI_FILE_TP.NAME_T)
RETURN SYS_REFCURSOR
IS
retval INI_FILE_TP.INI_FILE_RC;
BEGIN
OPEN retval FOR
SELECT *
FROM INI_FILE
WHERE NAME = NAME_IN;
RETURN retval;
END;
-- Return all rows in table via a reference cursor
FUNCTION all_rows_rc
RETURN SYS_REFCURSOR
IS
retval INI_FILE_TP.INI_FILE_RC;
BEGIN
OPEN retval FOR SELECT * FROM INI_FILE;
RETURN retval;
END;
END INI_FILE_QP;
Edited by: sfrade on Jan 14, 2009 6:02 PM

Hi,
I found a temporary solution:
Edit directly the XSD file:
I add under sources the overloaded function and set the parameters correctly.
Do not forget to rename the dotnet functions. It is forbidden to have duplicate function name in DOTNET XSD.
Hope it helps.
However as I said it is a temporary solution.
Cheers,
Seb
PS:
My problem stays open.
I hope someone else fix the problem more efficiently than me

Similar Messages

  • [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]

    Hii ..
    need help on this ..
    This what I am doing ..
    I am using a DATAEXPORT function to export level0 data from my essbase 11.1.2.2 to Microsoft SQL 2008 tables.
    So what I did first I exported the level0 data to a flat file using DATAEXPORT and the created the SQL columns by the same  in that order only in my SQL table.
    When I run it fails with this error:
    ODBC Layer Error: [21S01] ==> [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021014)
    ODBC Layer Error: Native Error code [213]
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Error(1012085)
    Unable to export data to SQL table [dataexp]. Check the Essbase server log and the system console to determine the cause of the problem.
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021002)
    SQL Connection is Freed
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Warning(1080014)
    Transaction [ 0x1c50001( 0x51ee7d66.0x80342 ) ] aborted due to status [1012085].
    [Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1012579)
    Total Calc Elapsed Time for [test.csc] : [1.44] seconds
    =============================================================
    I did a simple test on my Sample.basic application then ..
    loaded the calc data to it and then used the below script to export to a flat file
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
                    DataExportLevel "Level0";
                    DataExportOverwriteFile ON;
                    DataExportColFormat OFF;
                    DataExportDimHeader OFF;
    FIX(
                "Jan",
                "Sales",
                "Actual"
    /*DATAEXPORT "File" "," "/home/hypadmin/samtest.txt";*/
    DATAEXPORT "DSN" "Abhitest" "sample" "sa" "welcome1";
    ENDFIX
    out put as below:
    "Sales"
    "100-30","California"
    "Jan","Actual",145
    Now In sql I created only 3 columns with name Jan/Sales/Actual and when I run this script again with comments removed .. I get the same error as what I have got in my first test case with other application ..
    but when I create the columns with same name as what its in export
    Sales/100-30/Califirnia/Jan/Actual
    It created the new rows successfully ..
    So with this I think the error which I am getting with my other application might be because of the same column issue  .. but then I have created all the columns by looking at the export file only as I did in sample ..
    Any idea would be helpful ..
    Thanks
    Abhishek
    I

    First make sure you add
    DataExportRelationalFile ON;
    to your set commands it is missing
    I alwats like to also add
    DataExportColHeader dimensionName;
    so I am sure what dimension is getting put into the columns.
    Then count the number of dimensions in your outline (exclude attribute dimensions). You need at least that many columns in your table  -1 + the number of  members you will be returning as columns in the export
    Taking your example Sample basic has 5 dimensions
    Measures
    Years
    Scenario
    Product
    Market
    Since you did not specify a dataexportcolheader it took the dense dimension Scenario as the columns. Your fix statement is limiting that to one member. Doing the math
    5 -1 + 1 = 5 columns in your table which is what you found works.  Suppose you fixed on bothe Actual and budget in scenario then you would need 6 columns 5 -1 +2

  • Java.sql.SQLException: invalid name pattern:schema.file_import_nestedtable

    Hi all,
    I am trying to insert an array in nested table to another table. I have a nested table by the name 'file_import_nestedTable'.
    code for object 'file_import_obj'
    CREATE OR REPLACE TYPE file_import_obj AS OBJECT
    column_1 datatype,
    column_2 datatype,
    column_n datatype
    and for nested table 'file_import_nestedTable'
    CREATE OR REPLACE TYPE file_import_nestedTable as TABLE OF file_import_obj
    I have a package in place and it is valid.
    The problem started when I tried to use the weblogic pool connection to call the procedure. But this was overcome by using the Oracle connection i.e another pool and not the weblogic's own connection pool.
    But now I'm facing this exception when I try to use the ArrayDescriptor.
    java.sql.SQLException: invalid name pattern: PFEP.file_import_nestedTable
    Here is my code...
    Class.forName("oracle.jdbc.driver.OracleDriver");
    connection = DriverManager.getConnection("jdbc:oracle:thin:@myserver:1521:ANSD","user","password");
    // its throwing exception here.
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor("file_import_nestedTable",connection);
    ARRAY arr1 = new ARRAY(desc,connection,strArrHeaderBodyData);
    OracleCallableStatement call[i]Long postings are being truncated to ~1 kB at this time.

    Hi all,
    I am trying to insert an array in nested table to another table. I have a nested table by the name 'file_import_nestedTable'.
    code for object 'file_import_obj'
    CREATE OR REPLACE TYPE file_import_obj AS OBJECT
    column_1 datatype,
    column_2 datatype,
    column_n datatype
    and for nested table 'file_import_nestedTable'
    CREATE OR REPLACE TYPE file_import_nestedTable as TABLE OF file_import_obj
    I have a package in place and it is valid.
    The problem started when I tried to use the weblogic pool connection to call the procedure. But this was overcome by using the Oracle connection i.e another pool and not the weblogic's own connection pool.
    But now I'm facing this exception when I try to use the ArrayDescriptor.
    java.sql.SQLException: invalid name pattern: PFEP.file_import_nestedTable
    Here is my code...
    Class.forName("oracle.jdbc.driver.OracleDriver");
    connection = DriverManager.getConnection("jdbc:oracle:thin:@myserver:1521:ANSD","user","password");
    // its throwing exception here.
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor("file_import_nestedTable",connection);
    ARRAY arr1 = new ARRAY(desc,connection,strArrHeaderBodyData);
    OracleCallableStatement call[i]Long postings are being truncated to ~1 kB at this time.

  • Oracle.xml.sql.OracleXMLSQLException: Expected name instead of .

    Hi,
    I'm using XDK in Tomcat to execute queries and get the XML result in the browser. I have written many queries but now I'm having problems in one of them.
    The error output that I see in my browser is this one:
    <ROOT>
    <ERROR>
    oracle.xml.sql.OracleXMLSQLException: Expected name instead of <.
    </ERROR>
    </ROOT>:
    This error message is known as XML-20126 but it's not documented in the XML Developer's Kit Programmer's Guide, so I don't know what to do.
    My XSQL query is the following:
    <ROOT connection="xxxx_read" xmlns:xsql="urn:oracle-xsql">
    <xsql:query>
    SELECT XMLAGG(XMLELEMENT("NODE",
    XMLELEMENT("name", b.nodename),
    (SELECT XMLAGG(XMLELEMENT("SERVICE",
    XMLATTRIBUTES(a.serviceabbr AS "type")
    ORDER BY a.serviceabbr
    FROM service a, serviceinstance c
    WHERE c.isdeleted='N'
    AND a.serviceid=c.serviceid
    AND c.nodeid=b.nodeid
    ORDER BY b.nodename
    ) AS "NODES"
    FROM node b
    WHERE b.isdeleted='N'
    </xsql:query>
    </ROOT>
    That query executes fine in sqlplus, where I can see the XML result.
    I think my problem could be related to the size of the XML output. In sqlplus, the output has around 38000 bytes size, which is nothing, so I don't really know why that should be a problem. Do you have any idea?
    Thanks for your help,
    David

    So it seems there is a problem in fact:
    XDB FUNCTION RESULTS ARE TRUNCATED WHEN USING XSQL
    *** 02/25/04 08:28 am ***
    Problem Description
    There appears to be a limit on the content or characters that XSQL pages
    handle when being passed data from XDB functions such as XMLAGG() and
    XMLELEMENT().
    If you have a xsql page of the form
    < ?xml version="1.0"?>
    < xsql:query xmlns:xsql="urn:oracle-xsql" connection="demo" >
    select XMLAgg(XMLElement("Test", XMLAttributes(i.id as "Id_van_de_test",
    i.name as "Name_van_de_test"))) as "Tests" from problem_xml i
    < /xsql:query>
    If the number of rows (or amount of data) in the table is low, the result
    appears okay. However, if the data returned is large the data appears to
    truncate giving xml parsing errors as if the xml returned is not well formed.
    In the testcase provided, the error is as follows :-
    Results from 10.1.0.2
    < Line 2, Column 16354>: XML-20126: (Fatal Error) '< ' cannot appear in attribute value.
    < Line 2, Column 16366>: XML-20190: (Fatal Error) Whitespace required.
    < Line 2, Column 16366>: XML-20201: (Fatal Error) Expected name instead of 4.
    < ?xml version = '1.0'?>
    value.< /ERROR>
    Results from 9.2.0.6
    < Line 2, Column 16354>: XML-0126: (Fatal Error) '< ' cannot appear in attribute value.
    < Line 2, Column 16368>: XML-0190: (Fatal Error) Whitespace required.
    < Line 2, Column 16368>: XML-0201: (Fatal Error) Expected name instead of 3.
    < Line 2, Column 16371>: XML-0122: (Fatal Error) '=' missing in attribute.
    < Line 2, Column 16391>: XML-0190: (Fatal Error) Whitespace required.
    < Line 2, Column 16396>: XML-0122: (Fatal Error) '=' missing in attribute.
    < Line 2, Column 16397>: XML-0125: (Fatal Error) Attribute value should start with quote.
    < ?xml version = '1.0'?>
    value.< /ERROR>
    And the workaround:
    ======================================================
    The only workaround we have is to get the Document generated using
    DBMS_XMLQUERY [with expanded entities].
    _==Start===
    create or replace procedure Query2XML(QueryString varchar2 default
    'select col1 from xml_tab where r_id = ?') IS
    XMLCtx number;
    myXML clob;
    myXMLLength number;
    BEGIN
    XMLCtx := DBMS_XMLQUERY.NEWCONTEXT(QueryString);
    myXML := DBMS_XMLQUERY.GETXML(XMLCtx);
    myXMLLength := DBMS_LOB.GETLENGTH(myXML);
    DBMS_XMLQUERY.CLOSECONTEXT(XMLCtx);
    END Query2XMLFile;
    _==Start===
    Currently, XDB uses a DOM based model for XSLT evaluation. It is not
    possible to support disable-output-escaping constructs through this
    evaluation. This might be supported in a future release when a different
    model is implemented.
    =============================================================

  • SQL Alter Column Name

    I am trying to change the name of a column in my Oracle database using SQL PLUS. This is what I'm doing:
    ALTER TABLE projects
    RENAME COLUMN thomas_comp_type TO thomas_comp_shipped_via;
    When I do this it gives me an error stating ORA-14155 Missing PARTITION or SUBPARTITION keyword.
    What does this mean and how do I fix it?

    Hang on: you're trying to rename a column called NAME?
    That's one of Oracle's reserved keywords so should never have been used as a column name in the first place:
    SQL> select * from v$reserved_words where keyword like 'NAME';
    KEYWORD                            LENGTH R R R R D
    NAME                                    4 N N N N NThat said, you are able to do such a rename without an issue in 10g:
    SQL> create table t1 (name varchar2(10));
    Table created.
    SQL> alter table t1 rename column name to fred;
    Table altered.
    SQL> desc t1;
    Name                                      Null?    Type
    FRED                                               VARCHAR2(10)Oracle 9i is obviously a different matter ...and it doesn't help that it's such an old version, because I don't have a machine running that to hand to test things out on. You could try double-quoting the column name:
    SQL> alter table t1 rename column "FRED"  to barney;
    Table altered.But I can't guarantee that will work.

  • DNS name for sql clustering instance name

    Hi all,
    sql 2005 or sql 2008 clustering on windows 2008 R2
    We create sql 2005 or sql 2008 clustering.  The sql clustering
    instance name (DNS name) was created manaully or created automatically in DNS.
    is it issue if sql instance name was created manaully in DNS?
    Thank you.

    Hi,
    For the manual create the CNO usually cause may issue, you'd better don't use that method.
    The related article:
    Windows 2008/ Windows 2008 R2 CNO Recovery
    http://blogs.technet.com/b/hugofe/archive/2010/03/11/windows-2008-windows-2008-r2-cno-recovery.aspx
    Hope this helps.
    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.

  • Dynamic SQL : passing table name as parameter

    Hi
    I have a SQL query (a store procedure )  that i want to convert to PLSQL
    This is a part of my SQL query that i am trying to to find a solution for it, because i cant convert it to oracle :
    DECLARE lookupTableRow CURSOR FOR
      SELECT TableName FROM SYS_LookUpTable
      OPEN lookupTableRow
      FETCH NEXT FROM lookupTableRow INTO @tableName
      WHILE @@FETCH_STATUS=0
      BEGIN
      SET @sql='SELECT * FROM '+@tableName
    EXECUTE sp_executesql @sql
      IF @counter=0
      BEGIN
      INSERT INTO T_TABLE_MAPPING VALUES('P_MAIN_METADATA', 'Table', @tableName)
      END
      ELSE
      BEGIN
      INSERT INTO T_TABLE_MAPPING VALUES('P_MAIN_METADATA', 'Table'+CONVERT(NVARCHAR(10),@counter), @tableName)
      END
      SET @counter=@counter+1
      FETCH NEXT FROM lookupTableRow INTO @tableName
      END
      CLOSE lookupTableRow
      DEALLOCATE lookupTableRow
    As i understand i can't use ORACLE dynamic sql (execute immediate) when the table name is a parameter
    Furthermore when i execute this dynamic query in my SQL store procedure each SELECT statement return me as a result the relevant table rows , those result are different in each loop .
    So i cant do this too with ORACLE dynamic sql .
    Please advice for any solution
    * how can i use dynamic sql with table name as parameter ?
    * how can i use a "dynamic" cursor, in order to be able to display the dynamic results ?
    Thanks for the advice

    Hi,
    b003cf5e-e55d-4ff1-bdd2-f088a662d9f7 wrote:
    Hi
    I have a SQL query (a store procedure )  that i want to convert to PLSQL
    This is a part of my SQL query that i am trying to to find a solution for it, because i cant convert it to oracle :
    DECLARE lookupTableRow CURSOR FOR
      SELECT TableName FROM SYS_LookUpTable
      OPEN lookupTableRow
      FETCH NEXT FROM lookupTableRow INTO @tableName
      WHILE @@FETCH_STATUS=0
      BEGIN
      SET @sql='SELECT * FROM '+@tableName
    EXECUTE sp_executesql @sql
      IF @counter=0
      BEGIN
      INSERT INTO T_TABLE_MAPPING VALUES('P_MAIN_METADATA', 'Table', @tableName)
      END
      ELSE
      BEGIN
      INSERT INTO T_TABLE_MAPPING VALUES('P_MAIN_METADATA', 'Table'+CONVERT(NVARCHAR(10),@counter), @tableName)
      END
      SET @counter=@counter+1
      FETCH NEXT FROM lookupTableRow INTO @tableName
      END
      CLOSE lookupTableRow
      DEALLOCATE lookupTableRow
    As i understand i can't use ORACLE dynamic sql (execute immediate) when the table name is a parameter
    Furthermore when i execute this dynamic query in my SQL store procedure each SELECT statement return me as a result the relevant table rows , those result are different in each loop .
    So i cant do this too with ORACLE dynamic sql .
    Please advice for any solution
    * how can i use dynamic sql with table name as parameter ?
    * how can i use a "dynamic" cursor, in order to be able to display the dynamic results ?
    Thanks for the advice
    I have a SQL query (a store procedure )  that i want to convert to PLSQL
    I doesn't help when you use one term to mean another thing.
    SQL is a language used in both Oracle and other products, such as Microsoft's SQL Server. I don't know much about SQL Server, but Oracle (at least) doesn't support stored procedures in SQL itself; they have to be coded in some other language, such as PL/SQL.  
    As i understand i can't use ORACLE dynamic sql (execute immediate) when the table name is a parameter
    If the table name is a parameter (or only known at run-time for any reason), that's exactly the kind of situation where you MUST use dynamic SQL.
    The number of columns that a query produces (and their datatypes) is fixed when you compile a query, whether that query is dynamic or not.  If you have multiple queries, that produce result sets with different numbers of columns, then you can't combine them into a single query.  The best you can do with one query is to add NULL columns to some of the queries so they all produce the same number of columns.
    If you're just displaying the results, there might not be any reason to combine separate result sets.  Just display one result set after another.
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Java.sql.SQLException: invalid name pattern : SCOTT.QUERYARRAY

    exception in Callable Statement : java.sql.SQLException: invalid name pattern: SCOTT.QUERYARRAY
    Below is the java code snippet :
    String[] arr=new String[2];
    arr[0]="select sysdate from dual";
    arr[1]="select sysdate+1 from dual";
    oracle.jdbc.driver.OracleCallableStatement oraCall = (oracle.jdbc.driver.OracleCallableStatement)con.prepareCall("{call arrayTest(?,?)}");
    oracle.sql.ArrayDescriptor descrip = oracle.sql.ArrayDescriptor.createDescriptor("QUERYARRAY",con);
    oraCall.registerOutParameter(2,oracle.jdbc.OracleTypes.ARRAY,"QUERYARRAY");
    oracle.sql.ARRAY a = new oracle.sql.ARRAY(descrip,con,arr);
    oraCall.setARRAY(1,a);
    oraCall.execute();
    where "QUERYARRAY" is an array type created in oracle as
    create or replace TYPE QUERYARRAY is VARRAY(20) OF VARCHAR2(500);
    my procedure is :
    create or replace procedure arrayTest(array_in IN QUERYARRAY,array_out OUT QUERYARRAY)
    is
    begin
         for i in 1..array_in.count
         loop
         dbms_output.put_line('Query '||i||array_in(i));
         end loop;
    end;     
    The Exception is thrown at
    oracle.sql.ArrayDescriptor descrip =
    oracle.sql.ArrayDescriptor.createDescriptor("QUERYARRAY",con);
    oraCall.registerOutParameter(2,oracle.jdbc.OracleTypes.ARRAY,"QUERYARRAY");
    Please do let me know how to resolve the issue.
    thanks in advance....

    Has anyone found a solution to this??? I have the same problem. I seems to be a permissions problem since JDBC driver tries to access the types in my schema and not the owner of the types.

  • How to change the default sql servery query name?

    Whenever we click on new query button, Sql server automatically opens a new query with default name SQLQuery1.sql.
    Can I change this default name? What I mean to say is I have to work with quite a number of databases on different servers. So I open multiple queries on different server. So I was finding a way where whenever I click on
    New Query button it inherits servername or database name (e.g If I have database name like ABCD new query name should look like ABCDquery.sql ?)
    So that I can distinguish which query belong to which Database?
    I would be very greateful if you can please answer this.
    Many thanks

    Please try with different color code option for your servers:
    Ref: http://technet.microsoft.com/en-us/library/hh213617.aspx
    Set the Status Color for a Server in Object Explorer
    To set a server status color in Object Explorer
    In Object Explorer, select the Connect button and then select Database
    Engine….
    On the Connect to Server dialog, select Options >>.
    Select the Use custom color check box.
    To select the color, select the Select… button.
    Select either a basic or custom color, then select OK.
    Fill in the rest of the connection information, and then select the Connect button.
    Note: This is to identify different server connected not for databases.

  • SQL query - Alias name (value) as parameter to an Oracle function

    Hi,
    I have a sql query something like
    Select tbl1.valueA, tbl1.valueB, tbl2.valueX, MAX(CASE tbl2.valueY = 'XX' THEN tbl2.valueZ END) AS "ValueZ header", Function(tbl1.valueB, tbl2.valueX, "valueZ header")
    FROM table1 tbl1
    JOIN table2 tbl2 ON tbl1.id = tbl2.tbl1id
    WHERE ...
    my problem is that I need the value from MAX statement as parameter to the function and I have tried to use the alias name (valueZ header) but this is not working. I guess because of some syntax error. Can I use alias name as parameter into the function at all - if - how should I do this?

    Hi,
    user8819407 wrote:
    Hi,
    I have a sql query something like
    Select tbl1.valueA, tbl1.valueB, tbl2.valueX, MAX(CASE tbl2.valueY = 'XX' THEN tbl2.valueZ END) AS "ValueZ header", Function(tbl1.valueB, tbl2.valueX, "valueZ header")
    FROM table1 tbl1
    JOIN table2 tbl2 ON tbl1.id = tbl2.tbl1id
    WHERE ...
    my problem is that I need the value from MAX statement as parameter to the function and I have tried to use the alias name (valueZ header) but this is not working. I guess because of some syntax error. Can I use alias name as parameter into the function at all - if - how should I do this?You can use a column alias in the ORDER BY clause of the same query where it was defined, but that's the only place where you can use it in that query.
    You could repeat the entire MAX (CASE ...) expression as the 3rd argumnet to your function, or you could compute it once in a sub-query, then reference the column alias as often as you like in the super-query, like this:
    WITH     got_valuez_header     AS
         Select  tbl1.valueA
         ,     tbl1.valueB
         ,     tbl2.valueX
         ,     MAX ( CASE
                            WEHN  tbl2.valueY = 'XX'     -- Don't forget the keyword WHEN
                      THEN      tbl2.valueZ
                    END
                  )          AS "ValueZ header"
         FROM         table1     tbl1
         JOIN         table2     tbl2     ON     tbl1.id     = tbl2.tbl1id
         WHERE          ...
         GROUP BY     ...
    Select  tbl1.valueA
    ,     tbl1.valueB
    ,     tbl2.valueX
    ,     "ValueZ header"
    ,     Function_x ( tbl1.valueB     -- FUNCTION is not a good name for a function
                 , tbl2.valueX
                 , "ValueZ header"     -- Case-sensitive
    FROM    got_valuez_header
    ;

  • Use variable in SQL for column name

    Hi All,
    We want to use a user input as a column name in APEX.
    For e.g user will enter "ALLOWABLE_AMOUNT" then the query will be as follows  :
    select Rule,rule_name,rule_desc,"User Input" from rule_dim
    where "User_input" > 100
    So here the User_input will be substitued with Allowable_amount. Is this doable using any bind/substitution variables ? I tried ":P2_USER_VARIABLE" and "&P2_USER_VARIABLE." but did not work.
    Please advice.

    Hi Andy,
    You do that with an Interactive Report and a Dynamic Action.
    I'll assume that you're using APEX 4.2
    Here's how:
    Create Page 2 with an Interactive Report
    Create New Page > Report > Interactive Report > Next > Next
    Enter a SQL Select statement: select Rule,rule_name,rule_desc from rule_dim
    Next > Create > Edit Page
    Create the item P2_USER_VARIABLE
    Add Item > Number Field > Next
    Item Name: P2_USER_VARIABLE
    Next > Next > Next
    Source Used: Always, replacing any existing value in session state
    Source Type: Static Assignment (value equals source attribute)
    Create Item
    Create a Dynamic Action to refresh the Interactive Report when P2_USER_VARIABLE is changed
    Add Dynamic Action
    Name: Refresh IRR
    Next >
    Event: Lose Focus
    Selection Type: Item(s)
    Item(s): P2_USER_VARIABLE
    Next >
    Action: Refresh
    Next >
    Selection Type: Region
    Region: Report 1 (10)
    Create Dynamic Action
    Add the ALLOWABLE_AMOUNT to the Interactive Report
    Report 1
    Region Source: SELECT * FROM (select Rule,rule_name,rule_desc, :P2_USER_VARIABLE AS ALLOWABLE_AMOUNT from rule_dim) WHERE ALLOWABLE_AMOUNT > 100
    Apply Changes > Apply Changes
    Get the Interactive Report to submit P2_USER_VARIABLE
    Report 1
    Page Items to Submit: P2_USER_VARIABLE
    Apply Changes
    Change the Heading for ALLOWABLE_AMOUNT in the Interactive Report
    Interactive Report
    Change the Heading of ALLOWABLE_AMOUNT to &P2_USER_VARIABLE.
    Apply Changes
    Run
    Enter something into the USER VARIABLE field and select something else on the page. Watch the last column update to that value.
    Tim.

  • Sql Transposing Column Name in Row

    i am using Sql Server 2008
    tbl_EmployeeProfile
    EmployeeId EmployeeName LeaveApplicable Active
    1 Sam true true
    2 Rahul false false
    3 Sameer true true
    tbl_MasterLeave
    id LeaveCode Description active
    1 PL Paid Leave true
    2 CL Casual Leave true
    3 SL Sick Leave false
    tble_LeaveAllocation
    EmployeeId Period 1 2 3 .........31
    1 2014 18 4
    3 2014 20 4
    note: tble_Masterleave.id = tble_LeaveAllocation.1( column Name)
    i.e  value of tbl_masterleave id is mape with column name of tble_LeaveAllocation 1,2,.....31
    Expected out put
    EmployeeId EmployeeeName Period PL CL
    1 Sam 2014 18 4
    3 Sameer 2014 20 4
    Note: show only record who is active = true & leaveApplicable = true  .
    why i made this table structure  because non of organization leave type are not fixed, so user can customize leave according their requirment , so i made tbl_ allocation table with 1 to 31 column , so user can allocate leave type max 31.
    please advice me is it right method or any other good alternative solution 
    Thanks Best Regard Naweez

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    Why are you so special that you do not have to post DDL? I Googled you and got nothing that would grant you privilege. 
    You have the manners of a pig and your code is garbage. Look up tibbling in the “code smells” paper. That is what we call your “tbl-”
     prefix when we laugh at you. 
    Why do you write SQL with assembly language flags? SQL programmers do not! Why did you use the term “master_” on a table name? This term is from tape files and network DB; it has nothing to do with RDBMS!! 
    Why do you think that “active” is an attribute? NO! It is a value of some particular attribute and needs a temporal range. 
    There is no generic “id” in RDBMS! Remember the Law of Identity from your first freshman logic class? Rows are not records, so you got that term wrong. We do not use mappings in RDBMS; we have REFERENCES. 
    CREATE TABLE Personnel
    (emp_id CHAR(10) NOT NULL PRIMARY KEY,
     emp_name VARCHAR(35) NOT NULL);
    CREATE TABLE Leave_Codes
    (leave_code CHAR(2) NOT NULL PRIMARY KEY,
     leave_code_description VARCHAR (20) NOT NULL);
    INSERT INTO Leave_Codes
    VALUES 
    ('PL', 'Paid Leave'),
    ('CL', 'Casual Leave'),
    ('SL', 'Sick Leave);
    I might have done this: 
    CREATE TABLE Employee_Leaves
    (emp_id CHAR(10) NOT NULL
     REFERENCES Personnel(emp_id)
     leave_start_date DATE NOT NULL,
     leave_end_date DATE NOT NULL,
    CHECK(leave_start_date < leave_end_date),
     leave_code CHAR(2) NOT NULL
      REFERENCES Leave_Codes (leave_code),
     PRIMARY KEY (??),
     >> why I made this table structure because our organization leave type are not fixed, so user can customize leave according their requirement, so I made allocation table with 1 to 31 column, so user can allocate leave type max 31. <<
    No, you did this out of ignorance. You do not understand RDBMS or SQL.  YHou do not know any of the basics. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Using SQL alias column names in same SQL

    Hi,
    I am converting some Teradata SQL queries and these queries have the ability to use column defined aliases within the same query, something like :
    SQL> select 'test' as alias1, 'test2' as alias2, alias1 from dual
    Does anyone know how I can get Oracle to do this ????
    Many thanks
    Ben

    Hi,
    Yes I did think of that - its just the queries calculated columns are quite large - sample below show a value calculated currently based on alias names - just trying to find an easier way to apply.
    I was hoping for some magical syntax that has eluded me !
    Ben
    (exp(case when (constant_contrib + fsnumber_contrib + herolevel_contrib + is_colmans_contrib + is_heinz_contrib + is_short_life1_contrib + is_short_life2_contrib + is_short_life3_contrib + logcount_prod_contrib + offer_shelf_cap_contrib + promointensity_contrib + std_shelf_cap_contrib + xforprice_add_1_contrib + ( (power(sh_ms_variables.xfspr,1)) * formula_coefficients.coeff_xfspr1 ) + ( (power(sh_ms_variables.xfspr,2)) * formula_coefficients.coeff_xfspr2 ) + ( (power(sh_ms_variables.xfspr,3)) * formula_coefficients.coeff_xfspr3 ) + ( (power(sh_ms_variables.xfspr,4)) * formula_coefficients.coeff_xfspr4 ) + ( sh_ntnl_variables.xnfor2 * formula_coefficients.coeff_xnfor2 ) + ( sh_ms_variables.xnforfs1 * formula_coefficients.coeff_xnforfs1 ) + ( sh_ms_variables.xnforfs2 * formula_coefficients.coeff_xnforfs2 ) + ( sh_ms_variables.xnforfspl * formula_coefficients.coeff_xnforfspl ) + ( sh_ntnl_variables.xnforpl * formula_coefficients.coeff_xnforpl ) + ( (power(sh_ms_variables.xpr,1)) * formula_coefficients.coeff_xpr1 ) + ( (power(sh_ms_variables.xpr,2)) * formula_coefficients.coeff_xpr2 ) + ( (power(sh_ms_variables.xpr,3)) * formula_coefficients.coeff_xpr3 ) + ( (power(sh_ms_variables.xpr,4)) * formula_coefficients.coeff_xpr4 )) < 500 then (constant_contrib + fsnumber_contrib + herolevel_contrib + is_colmans_contrib + is_heinz_contrib + is_short_life1_contrib + is_short_life2_contrib + is_short_life3_contrib + logcount_prod_contrib + offer_shelf_cap_contrib + promointensity_contrib + std_shelf_cap_contrib + xforprice_add_1_contrib + ( (power(sh_ms_variables.xfspr,1)) * formula_coefficients.coeff_xfspr1 ) + ( (power(sh_ms_variables.xfspr,2)) * formula_coefficients.coeff_xfspr2 ) + ( (power(sh_ms_variables.xfspr,3)) * formula_coefficients.coeff_xfspr3 ) + ( (power(sh_ms_variables.xfspr,4)) * formula_coefficients.coeff_xfspr4 ) + ( sh_ntnl_variables.xnfor2 * formula_coefficients.coeff_xnfor2 ) + ( sh_ms_variables.xnforfs1 * formula_coefficients.coeff_xnforfs1 ) + ( sh_ms_variables.xnforfs2 * formula_coefficients.coeff_xnforfs2 ) + ( sh_ms_variables.xnforfspl * formula_coefficients.coeff_xnforfspl ) + ( sh_ntnl_variables.xnforpl * formula_coefficients.coeff_xnforpl ) + ( (power(sh_ms_variables.xpr,1)) * formula_coefficients.coeff_xpr1 ) + ( (power(sh_ms_variables.xpr,2)) * formula_coefficients.coeff_xpr2 ) + ( (power(sh_ms_variables.xpr,3)) * formula_coefficients.coeff_xpr3 ) + ( (power(sh_ms_variables.xpr,4)) * formula_coefficients.coeff_xpr4 )) else 500 end ) - 1) AS uplift,
    Edited by: user485052 on Dec 10, 2010 3:08 AM

  • SQL query alias names errors with dynamic lists

    Hullo,
    Problem:
    - Made a query form book database. Have authors in separate table with unique ID's referring to them on book table.
    - Query fetches author name in "Surname, Firstname initial.Secondfirstname initial" format, --> like "Bukowski, H.C" and giving that combo alias name in SQL like "AS 'author'"...
    - Dynamic list works fine at start, but when ordered from detail table back to the mainlisting, it does make an error with SQL stating "unknown column 'author' in where clause"
    That must be because the script looks for "author" column from the original table yeah, but how can I solve this? Any ideas? Does this mean that Alias names for columns are not possible or is there something i've missed?
    Any ideas, suggestions?
    Thanks,
    KimmoK

    Hi Kimmo,
    ADDT´s dynamic lists can handle alias columns fine to my experience, but I reckon that you most probably applied the "CONCAT(...) AS author" query modification after having generated the list, and the list´s internal WHERE clause seems to have no clue of this alias column.
    You can get an idea about using alias columns in Dynamic Lists in my tutorial "Dynamic Lists: exploring the Filter Conditions": http://www.guenter-schenk.com/tutorials/tutorial.php?id=6
    Can you please post the list´s code on your server as text file (e.g. code.txt) and provide a link to this file ?
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Sql Loader INFILE name value in table column Value

    Hi,
    Here is my Sql Loader Script
    LOAD DATA
    infile '%1'
    APPEND INTO TABLE XX_SUPPLIER_UPD
    FIELDS TERMINATED BY ";" OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
    ACTION Char
    ,ADDRESS_TYPE Char
    ,REGION Char "LTRIM(RTRIM(:REGION))"
    ,PO_BOX Char
    ,,WWW_ADDRESS Char
    ,status Char "NVL(:status,'X')"
    ,filename Char "replace(:infile,'\"','')"
    I am getting the infile name as the parameter and i want to insert that parameter value in the column name fillename. Can any one guide me to how to do.
    Cheers!
    Jayaraj.S

    If you were to use external tables instead of SQL*Loader, you can dynamically change the location of the external table (i.e. the filename) using a simple ALTER TABLE statement.
    External tables also mean that all the control is inside the database rather than relying on external utilities and external scripts.
    ;)

Maybe you are looking for

  • On Screen Keyboard with Quickweb

    How do you access the on screen keyboard when your in quickweb if you are using the system in tablet setup?

  • How to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part

    Hi, I want to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part like mentioned below: http://server/pages/Default.aspx?Title=Arup&Title=Ratan But it always return those items whose "Title" value is "Arup

  • Playstation 3 not connecting to PSN

    I've just moved from BT standard to Sky Fibre and since the move I cannot get my PS3 to connect to the playstation network. The main reason for upgrading was for better gaming!Anyone with any ideas?I've tried setting a static IP, changing channels an

  • RAID configuration, better to logically split RAID5 or RAID1 with SQL?

    I want to setup a new SQL server with SQL 2008 R2.  I have to use this version due to the application support behind it.  I have a question regarding best practice with disk setup on a physical server.  Here is my proposed setup, but the application

  • Add marker

    Hello.. Let me define my final goal: building a modern spectrum analyzer by the SR-760 model. The Problem: i need to add a MARKER to the Spectrum graph output. MARKER mean that in the real spectrum analyzer there is a "turning scroll button" that you