Apply SQL query into Object

I am currently developing a system where it retrieve a table from a DB, and then store the table information in an Object.
Q1, How can I create a Object which represents a table
Q2, If I have such a table, how can I apply SQL statement to that table Object so that it will return the date as we do in a DB

Sorry to break it to you, but from the nature of your questions it seems like you've taken up too big a task for you.
1.) Anything can represent a table. A simple Collection of Row objects would be a possibility.
2.) Parsing and executing SQL can be quite a large task, which is not easily described in such a forum.
All in all I'd suggest you simply use another in-memory DB, such as HSQLDB. They've already implemented everything you speak of.

Similar Messages

  • Can I put a SQL query into a bind variable and then use it to output report

    Hi,
    Can I put a SQL query into a bind variable and then use it to output report?
    I want to create a report and an item "text area" (say P1_TEXT) which can let user to input a SQL query(they are all technical users and knows SQL very well). Then, I use a bind variable (that text area) to store the SQL statement. Then, I add a submit button and I want to use the following to output the report:
    select * from (:P1_TEXT);
    Do you think it is possible to do that? Any known limitations for APEX in this area?
    Thanks a lot,
    Angela

    You can, but make sure it's what you really want to do. Make sure you are VERY familiar with SQL Injection. Most people who know what it is, go out of their way to prevent SQL Injection. You're going out of your way to allow it.
    You can try using &P1_TEXT. instead of bind variable syntax. Bind variables are one of the best ways to prevent SQL Injection, which is why it's not working for you.
    Once again, I strongly urge you to consider the implications of your app, but this suggestion should get it working.
    Tyler

  • Help with SQL query into Crystal

    Afternoon all,
    I am trying to convert the following SQL query into Crystal by using the tables given in the query however the relationship given in the query is bit awkward, in a sense that I cannot create a relationship under Crystal desgin.
    Here is the query
    select count(order_progressed.order_no),reason_code
    from order_progressed,lab_reasons, rework_groups
    where
    order_progressed.date_created=Today
    and (order_progressed.order_status=from_gate
    and lab_reasons.reason_code between from_reason and to_reason)
    group by lab_reasons.reason_code
    order by 2
    We have three tables
    1: Order_Progressed
    2: Lab Reasons
    3: Rework_Groups
    Order_progressed can be linked with rework_group by Status (if you see the line order_progressed.order_status=from_gate)
    However how to link the following line?
    lab_reasons.reason_code between from_reason and to_reason
    I mean when I try to link it by Lab Reasons.Reason Code to From_reason, to reason, it doesn't seem to work.
    The report is grouped by Lab Reasons. Reason Code, so I really have to some how create a relationship between Lab Reasons table and Rework_Group table.
    This is what I get when I run the same query into Crystal using the relationship
    SELECT lab_reasons.reason_code, order_progressed.date_created, order_progressed.order_no
    FROM   maxmast.lab_reasons lab_reasons, kevin.order_progressed order_progressed,
    roger.rework_groups rework_groups
    WHERE  (order_progressed.order_status=rework_groups.from_gate) AND
    ((lab_reasons.reason_code=rework_groups.from_reason) AND
    (lab_reasons.reason_code=rework_groups.to_reason)) AND (order_progressed.date_created>={ts
    '2008-01-01 00:00:00'} AND order_progressed.date_created<={ts '2008-12-17 00:00:00'})
    Any ideas?
    Many thanks
    Kind Regards
    Jehanzeb

    Sastry I didn't understand why did you use Lab_reasons.reason_code twice in your SQL.
    What I have done since I posted this thread,
    I created a command like this
    Select *
    from rework_groups,lab_reasons
    where
    lab_reasons.reason_code between from_reason and to_reason
    Then I took out the lab_reasons table and rework_groups table, then I linked the order_status from Order_progressed table to From_gate of the newly created table (I called it Reason_Code).
    This made the report running but it is crunching quite allot of numbers. I wonder if I made a mistake somewhere?
    Oh and please note, I'd like to create an SQL (if need be) without the date entry which was done in the original SQL because I'd like to setup my own date range within Crystal Reports instead of getting passed by SQL itself.
    This is how it looks like in Crystal now.
    sae1_live
    SELECT order_progressed.date_created, order_progressed.order_no, order_progressed.order_status
    FROM   kevin.order_progressed order_progressed
    WHERE  (order_progressed.date_created>={ts '2008-01-01 00:00:00'} AND
    order_progressed.date_created<={ts '2008-12-17 00:00:00'})
    EXTERNAL JOIN order_progressed.order_status={?sae1_live: Reason_Code.from_gate}
    sae1_live
    Select *
    from rework_groups, lab_reasons
    where lab_reasons.reason_code between from_reason and to_reason
    EXTERNAL JOIN Reason_Code.from_gate={?sae1_live: order_progressed.order_status}
    Regards
    Jehanzeb

  • SQL QUERY into PROCEDURE

    Hi! I am a newbie in PL/SQL..
    Can somebody teach me on how to make this SQL QUERY into a PROCEDURE?
    TABLE 1: LOGS
    TABLE 2: MASTER LIST
    Logs = records the logs
    Master list = list of all registered name.
    select * from table1
    where not exists
    select host, user, name
    from table2
    where table2.host = table1.host and
    table2.user = table1.user and
    table2.name = table1.name
    TABLE 1
    HOST | USER | NAME
    ==============
    1 | A | A1
    1 | A | A1
    1 | A | A1
    1 | A | D1
    TABLE 2
    HOST | USER | NAME
    =============
    1 | A | A1
    1 | A | B1
    1 | A | C1
    Result:
    HOST | USER | NAME
    ===============
    1 | A | D1
    Thanks. :)

    QKWS wrote:
    Hi! I am a newbie in PL/SQL..
    Can somebody teach me on how to make this SQL QUERY into a PROCEDURE?
    TABLE 1: LOGS
    TABLE 2: MASTER LIST
    Logs = records the logs
    Master list = list of all registered name.
    select * from table1
    where not exists
    select host, user, name
    from table2
    where table2.host = table1.host and
    table2.user = table1.user and
    table2.name = table1.name
    TABLE 1
    HOST | USER | NAME
    ==============
    1 | A | A1
    1 | A | A1
    1 | A | A1
    1 | A | D1
    TABLE 2
    HOST | USER | NAME
    =============
    1 | A | A1
    1 | A | B1
    1 | A | C1
    Result:
    HOST | USER | NAME
    ===============
    1 | A | D1
    Thanks. :)Hi,
    Question is not clear, really.
    Do you want that, I don't sure?
    CREATE TABLE t1 ( CHOST NUMBER,  CUSER VARCHAR2(10), CNAME VARCHAR2(10));
    INSERT INTO t1 VALUES(1,'A','A1');
    INSERT INTO t1 VALUES(1,'A','A1');
    INSERT INTO t1 VALUES(1,'A','A1');
    INSERT INTO t1 VALUES(1,'A','D1');
    Commit;
    CREATE TABLE t2 AS  SELECT *  FROM t1;
    INSERT INTO t2 VALUES(1,'A','A1');
    INSERT INTO t2 VALUES(1,'A','B1');
    INSERT INTO t2 VALUES(1,'A','C1');
    commit;
    select * from t1  table1
    WHERE NOT EXISTS
    ( SELECT 1 FROM t2 table2
       WHERE table2.chost = table1.chost
         AND table2.cuser = table1.cUSER
         AND table2.cNAME = table1.cNAME
    DECLARE
    P_HOST T1.CHOST%TYPE;
    P_USER T1.CUSER%TYPE;
    P_NAME T1.CNAME%TYPE;
    BEGIN
    select CHOST, CUSER,CNAME INTO P_HOST,P_USER, P_NAME
    from t1  table1
    WHERE NOT EXISTS
    ( SELECT 1 FROM t2 table2
       WHERE table2.chost = table1.chost
         AND table2.cuser = table1.cUSER
         AND table2.cNAME = table1.cNAME
    dbms_output.put_line('HOST | USER | NAME  : '|| TO_CHAR(P_HOST)||' | '||P_USER||' | '||P_NAME);
    END;
    /Regards
    Mahir M. Quluzade

  • Plugging a sql query into OWB.

    Hi,
    I have a complex Sql query which returns some records. I want to use this query in OWB. But i don't want to write any procedures or functions. Is there a way just to plug this code into OWB to run it.
    vasu

    Any objection to putting the query into a view?
    The only other possible way I can think of that might work would be to create an expression object, define your desired output columns in the output group, and then copy in your query per column as the defined expression for that column. (hardly the efficient option!). I think you might have to create some sort of dummy input for this to pass through the validation for expressions too (e.g. perhaps also use a constant defined as sysdate passed as an input to the expression, but then never referenced in the queries).
    Can't say for sure if you can fool OWB into using your query in an expression object or not - but that would be the only way I can think of which might be possible to avoid using a view/function/procedure.

  • Loading an Oracle SQL query into an MSSQL table

    I have a select query on an Oracle table. I want to load this data into an MSSQL table.
    Problem is that I cannot create an interim table on the Oracle database (lack of privelages)
    Is there a way to load an Oracle query into the MSSQL table without an interim table?
    Many thanks
    Z

    Yes,
    1) Create an ODI procedure
    2) Create a step inside
    3) at source tab put the oracle query
    4) at target tab put the sql insert code
    Refer to the oracle returned values like "#column_name_from_oracle_query"
    Make sense?
    Cezar Santos
    [www.odiexperts.com]

  • Combine multiple web services with the same SQL query into one

    Hello,
    I would like to ask a question regarding combine multiple similar web services into one. Can you please tell me if it is possible to combine 4-5 web services into one since they built on the same SQL query with 5 different criterias or condition so that the user can enter any of the 5 criterias to populate the data on the form instead of having 5 different web services?
    e.g Query: Select appName, permit#, address, phone, description, type, section, from table where appName = can be 'appName, permit#, address, phone, or description' to populate the rest of the data to the form.
    Does any one have ever done some thing like this in Workbench ES? If so please assist. I know it can be easier to build it in Visual Basic, C#, or dot.net but the requirement is to build it in workbench ES.
    Thanks in advance,
    Han Dao

    If you are querying for Name, PhoneNumber, and SSN, and you queried for all people with a phone number that started with 867, you would have a potentially long list of people.  So to keep track of all of the people, we store each record in XML complex elements.  The root node is just any name you want, and the repeating element is the complex element name. 
    So using the example from above, I'm going to specify the following:
         Root Node: Result
         Repeating Element: Person
    So now when I do a query, my resultXML will look like:
    <Result>
          <Person>
                 <Name>Alex</Name>
                 <PhoneNumber>867-5309</PhoneNumber>
                 <SSN>111-11-1111</SSN>
          </Person>
    </Result>
    If your query returned multiple results (like ours would probably), it would look like:
    <Result>
          <Person>
                 <Name>Alex</Name>
                 <PhoneNumber>867-5309</PhoneNumber>
                 <SSN>111-11-1111</SSN>
          </Person>
          <Person>
                 <Name>Han</Name>
                 <PhoneNumber>867-2169</PhoneNumber>
                 <SSN>222-22-2222</SSN>
          </Person>
    </Result>
    So Result and Person is just to give a little bit of structure to the xml result (containers really).  So you can name them whatever is helpful for you.
    The column name mappings map the query columns (Name, PhoneNumber, SSN) to some node in the XML (Name, PhoneNumber, SSN).  So you don't need to specify which field maps to what in the form.  Just copy the column names to the element name so you have a 1-to-1 naming.  If you want to manipulate the XML a bit though, you could do:
    Column Name               Element
    Name                            YourName
    PhoneNumber                Phone
    SSN                              Secret
    which would then make your xml look like:
    <Result>
          <Person>
                 <YourName>Alex</YourName>
                 <Phone>867-5309</Phone>
                 <Secret>111-11-1111</Secret>
          </Person>
    </Result>
    It lets you change the XML element names to whatever you want. Otherwise by default they take on their column names.
    In your form, you could bind to the WSDL through the Data Connections pane and point it to your web service.  This will then create form elements that you can just drag and drop allowing you to have the information available when the service gets ran.  Once the service is called, you can modify the field's data to get whatever information you need in order to populate other form fields. 
    If that is too confusing, feel free to send me your form (e-mail is on profile page) and I'll add comments to it to show you how to set up the form for the web service call (and also give me the link to your webservice)

  • Complete novice needs help getting SQL Query into Crystal Reports XI

    Post Author: MissMarnie
    CA Forum: Data Connectivity and SQL
    So I was given an intro level web course and a monster reference guide in prep to format a report. One of our developers wrote me everything I need for the report into a SQL Query and now I'm supposed to format it in CR XII literally do not know what to do from here. I'm able to set up the correct server as a datasource, if that's useful, but I don't know how to make the querey into a bunch of formattable fields in  CR. If anyone can walk me through this, I'd be so grateful. I've attempted to look up SQL query in both the help and the book but I keep hitting a wall. The help dialog says things like "press this button" with no reference to what "this button" is. I'm sure it's obvious to the knowledgeable but I'm in a complete fog. Thanks in advance   

    Post Author: synapsevampire
    CA Forum: Data Connectivity and SQL
    IF you're trying to get assistance with setting up a query as the source for a report, try posting your Crystal version and the database type.
    Different software works differently.
    In CR 9 and above, under the connection to the database you'll see Add Command. Select that and you can paste the query in.
    As for not knowing how to generate a report, that requires experience, there's no generic solution of course..
    -k

  • How to convert an sql query into a recordset?

    HI, I'm having a hard time building a locations of service form for users to insert, update the cities, counties, zip codes based on the states selected.
    so I found this  query that works great if I use basic  menus and text boxes, but can't use to make comma separated menus because it is nat a record set.
    The problem is that I have a table called zip_codes, with the following fields: state_label, Zip_b, county, city.
    zip codes correspond to the cities, counties and states.
    example:
    Colorado,  Colorado Springs, El Paso,  80918
    Users make a selection of state or states and the recordset is filtered by user selection.
    I manage the part of making a select mutiple drop menu that passes the values to my query page like this.
    <form action="litsTA.php"; method="post">
    <h3>Choose State(s)</h3>
    <p>hold Control key to select multiple states</p>
    <select  name="States_served[]_<?php echo $cnt1; ?>" multiple="multiple" onchange='showselection()'>
      <?php
    do { 
    ?>
      <option value="<?php echo $row_state['state_label']?>"><?php echo $row_state['state_label']?></option>
      <?php
    } while ($row_state = mysql_fetch_assoc($state));
      $rows = mysql_num_rows($state);
      if($rows > 0) {
          mysql_data_seek($state, 0);
           $row_state = mysql_fetch_assoc($state);
    ?>
    </select>
    <p>
      <input type="submit" value="submit" />
    </p>
    </form>
    And the query I need to convert into a recordset looks like this
      mysql_select_db($database_duitop, $duitop);
    $query_TONY = "SELECT * FROM zip_code WHERE state_label IN (";  
    for ($i=0; $i<=count($state_list)-1; $i++) {
    //echo $state_list[$i];
    $query_TONY = $query_TONY . "'" . $state_list[$i] . "'";
    if ($i < count($state_list)-1) {
    $query_TONY = $query_TONY . ", ";
    $query_TONY = $query_TONY . ") GROUP BY county ORDER BY state_label, city ASC";
    Any way that was my attempt to converting the query into a recordset.
    any help, or samples will be appreciated.

    Use Tcode SQ01.
    Give the query name press Enter.
    The query will be listed in the table below.
    Select the Query => From the Main menu select QUERY => More Functions => Display Report Name.
    You will get the program name, now go to Se38 and display the program...

  • Sql query into mapping

    hi ,
    can any one tell how to convert this query into owb mapping
    INSERT INTO SMSTG.CST_PROF_ADDRESS
    (IMS_ID,
    PROF_ADDRESS_ID
    ADDRESS_LINE_1,
    CITY,
    STATE_CODE,
    POSTAL_CODE,
    COUNTRY_CODE,
    SOURCE_PROF_ID,
    SOURCE_ADDRESS_ID,
    ADDRESS_SOURCE,
    ADDRESS_SOURCE_DATE,
    INACTIVE_DATE,
    INACTIVE_SOURCE,
    INACTIVE_PROF_ID,
    INACTIVE_ADDRESS_ID,
    LOAD_DATE)
    SELECT
    B.REF_PROF_X,
    B.REF_PROF_X||'|'||SUBSTR(A.ADDRESS_LINE_1,1,5)||'|'||SUBSTR(A.POSTAL_CODE,1,5) PROF_ADDRESS_ID,
    A.ADDRESS_LINE_1,
    A.CITY,
    A.STATE_CODE,
    A.POSTAL_CODE,
    A.COUNTRY_CODE,
    A.SFA_PROF_ID,
    A.SFA_ADDRESS_ID,
    A.ADDRESS_SOURCE,
    A.ADDRESS_SOURCE_DATE,
    NULL INACTIVE_DATE,
    NULL INACTIVE_SOURCE,
    NULL INACTIVE_PROF_ID,
    NULL INACTIVE_ADDRESS_ID,
    SYSDATE LOAD_DATE
    FROM SMSTG.CST_PROF_SFA A
    WHSUSR.MDT_SFA_PROF B
    WHERE B.SFA_PROF_ADDRESS_ID = A.SFA_PROF_ADDRESS_ID
    AND B.PUBLICATION_STATUS = 'C' AND B.END_DATE > SYSDATE
    (SELECT ''
    FROM WHSUSR.MDT_MASTER_PROF_ADDRESS D
    WHERE D.PROF_ADDRESS_ID = B.REF_PROF_X||'|'||SUBSTR(A.ADDRESS_LINE_1,1,5)||'|'||SUBSTR(A.POSTAL_CODE,1,5)
    AND D.ADDRESS_SOURCE_DATE =< A.ADDRESS_SOURCE_DATE
    AND D.PUBLICATION_STATUS = 'C' AND D.END_DATE > SYSDATE)
    OR NOT EXISTS
    (SELECT ''
    FROM WHSUSR.MDT_MASTER_PROF_ADDRESS E
    WHERE E.PROF_ADDRESS_ID = B.REF_PROF_X||'|'||SUBSTR(A.ADDRESS_LINE_1,1,5)||'|'||SUBSTR(A.POSTAL_CODE,1,5)
    AND E.PUBLICATION_STATUS = 'C' AND E.END_DATE > SYSDATE))
    AND ( EXISTS
    (SELECT ''
    FROM SMSTG.CST_PROF_HCPS_ADDRESS F
    WHERE F.PROF_ADDRESS_ID = B.REF_PROF_X||'|'||SUBSTR(A.ADDRESS_LINE_1,1,5)||'|'||SUBSTR(A.POSTAL_CODE,1,5)
    AND F.ADDRESS_SOURCE_DATE =< A.ADDRESS_SOURCE_DATE)
    OR NOT EXISTS
    (SELECT ''
    FROM SMSTG.CST_PROF_HCPS_ADDRESS G
    WHERE G.PROF_ADDRESS_ID = B.REF_PROF_X||'|'||SUBSTR(A.ADDRESS_LINE_1,1,5)||'|'||SUBSTR(A.POSTAL_CODE,1,5)))
    AND (EXISTS
    (SELECT ''
    FROM SMSTG.CST_PROF_IMS_RETURN H
    WHERE H.PROF_ADDRESS_ID = B.REF_PROF_X||'|'||SUBSTR(A.ADDRESS_LINE_1,1,5)||'|'||SUBSTR(A.POSTAL_CODE,1,5)
    AND H.ADDRESS_SOURCE_DATE =< A.ADDRESS_SOURCE_DATE)
    OR NOT EXISTS
    (SELECT ''
    FROM SMSTG.CST_PROF_IMS_RETURN I
    WHERE PROF_ADDRESS_ID = B.REF_PROF_X||'|'||SUBSTR(A.ADDRESS_LINE_1,1,5)||'|'||SUBSTR(A.POSTAL_CODE,1,5))) ;

    Hi,
    you can create mapping [use constant, expressions, join, filter, tables...], but not "convert this query into owb mapping".
    Best regards.
    IM

  • SQL query with object function

    I want to write a function, which returns more than one value and to include those values into a SQL statement. For example I want to query the RDB with....
    select t.id, my_function(t.id).value1 name, my_function(t.id).value2 address ....
    from table_x t
    where t.id between 1 and 10
    and bitand(my_function(t,id)).sec_id,2)>3
    Is it possible to do something like this?
    I tried to use object and table of objects(my_type) to return value of my_type but when I used
    select ......my_function(t.id).name,my_function(t.id).address ...
    from table_x
    where t.id=some_value;
    the function was called twice(i expected this result, but i don't know how to avoid it).
    Simple example
    CREATE OR REPLACE TYPE l_test AS OBJECT
    id NUMBER(10),
    name varchar2(100),
    a_date date
    CREATE OR REPLACE FUNCTION test_f2(test_number IN NUMBER)
    RETURN l_test
    IS
    a number;
    BEGIN
    select t_seq.nextval into a from dual;
    return l_test(a,'test value ='||test_number,sysdate+test_number);
    END;
    select test_f2(i.id).id client_id, test_f2(i.id).name client_name from r_owners i
    CLIENT_ID CLIENT_NAME
    1 test value =1
    3 test value =2
    I want to be able to loop in cursor and use those values
    All ideas are welcome!
    Thanks,
    Iassen Houbenov

    Check it out...
    SQL> CREATE OR REPLACE TYPE emp_add AS OBJECT
      2  (  office VARCHAR2(50),
      3     location VARCHAR2(50),
      4      MEMBER FUNCTION get_office RETURN VARCHAR2,
      5      MEMBER FUNCTION get_location RETURN VARCHAR2,
      6      CONSTRUCTOR FUNCTION emp_add(id NUMBER) RETURN SELF AS RESULT,
      7      CONSTRUCTOR FUNCTION emp_add(id NUMBER, office VARCHAR2,location VARCHAR2) RETURN
      8        SELF AS RESULT
      9  ) NOT FINAL;
    10  /
    Type created.
    SQL> CREATE OR REPLACE TYPE BODY emp_add IS
      2      MEMBER FUNCTION get_office RETURN VARCHAR2
      3      IS
      4      BEGIN
      5          RETURN SELF.office;
      6      END;
      7      MEMBER FUNCTION get_location RETURN VARCHAR2
      8      IS
      9      BEGIN
    10          RETURN SELF.location;
    11      END;
    12      CONSTRUCTOR FUNCTION emp_add(id NUMBER)
    13          RETURN SELF AS RESULT
    14      IS
    15      BEGIN
    16         SELECT dname, loc
    17         INTO   SELF.office, SELF.location
    18         FROM   dept
    19         WHERE  deptno = id;
    20         RETURN;
    21      END;
    22      CONSTRUCTOR FUNCTION emp_add(id NUMBER, office VARCHAR2,location VARCHAR2)
    23          RETURN SELF AS RESULT
    24      IS
    25      BEGIN
    26         SELF.office := office;
    27         SELF.location := location;
    28         RETURN;
    29      END;
    30  END;
    31  /
    Type body created.
    SQL> SELECT e.ename, e.d.office, e.d.location 
      2  FROM   ( SELECT ename
      3                 , (SELECT emp_add(emp.deptno) FROM dual ) d
      4           FROM   emp ) e
      5  /
    ENAME      D.OFFICE
    D.LOCATION
    SMITH      RESEARCH
    DALLAS
    ALLEN      SALES
    CHICAGO
    WARD       SALES
    CHICAGO
    ....Smoke me a kipper I'll be back before breakfast.
    Cheers, APC

  • Answer from a sql query into a java variable ?

    Hey!
    Got a simple question :
    String dml = ("INSERT INTO student " +
                                         "VALUES ( SELECT MAX(id) +1 FROM student "  +
                                         "','" + student.getFornavn() +
                                         "','" + student.getEtternavn() +
                                         "','" + student.getKlasse() + "')");This sql syntax would work in sql+ , but for some reason not in java.. Need to add 1 to max id every time new student are added , or is there any way i could make sql add a new unique nubmer when id = NULL ?
    The other solution could be to get the answer from SELECT MAX (id) + 1 into a java variable and use that number value in insert query ?
    Or maybe the best would be to make a procedure ?

    Thanks!
    How would the syntax be to execute this procedure in java :
    CREATE OR REPLACE PROCEDURE legg_til_student (p_fnavn student.fornavn%TYPE, p_enavn student.etternavn%TYPE, p_klasseid student.klasseid%TYPE) IS
    v_id student.id%TYPE;
    BEGIN
         SELECT MAX(id) +1 INTO v_id
         FROM student;     
         IF p_klasseid > 3 THEN
         DBMS_OUTPUT.PUT_LINE ('Ugyldig klasseid');
         ELSE
         INSERT INTO student VALUES (v_id, p_fnavn, p_enavn, p_klasseid);
         END IF;
    END;
    /Only this into a stmt sentence ? :
    exec legg_til_student ('Test', 'Test', 2); ? thanks :)

  • Input result from a SQL-query into a Variable in ProcessFlow

    I am trying to select a value from a table with file names.
    This file name should be input to an ftp function. I use a owb function to read the file name then I try to asign the result to a variable.
    The function GET_FILENAME looks like
    f_name varchar2(30);
    BEGIN
    select distinct FILENAME_SOURCE into f_name from CTL_SOURCE_FILES
    where FILEID = (select min(FILEID) from CTL_SOURCE_FILES where status is null);
    RETURN f_name;
    END;
    When running it as a SQL-script it returns only one row/name.
    When I am running it in the ProcessFlow the following message is found:
    RPE-02040: Internal error: GET_FILENAME cannot be converted to a constant value.

    Let me talk about this in context of a mapping:
    create a mapping :
    use a function within a mapping
    assign the output of the mapping to a mapping input variable"
    use this mapping within your process flow and see if it works.
    if you are directly going to use the output of a function in a process flow , the FTP should be able to accept the filename from the outparam of the function which i am not sure how it works.
    try using the first approach as it is relatively simple and straightforward.

  • Script task to convert output from a sql query into send mail task body formatting

    SSIS 2008R2 Version
    Code from script task
       Microsoft SQL Server Integration Services Script Task
       Write scripts using Microsoft Visual C# 2008.
       The ScriptMain is the entry point class of the script.
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    namespace ST_29dd6843bd6c4aee9b1656c1bbf55ba8.csproj
        [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
            #region VSTA generated code
            enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
            #endregion
            public void Main()
                Variables varCollection = null;
                string header = string.Empty;
                string message = string.Empty;
                Dts.VariableDispenser.LockForWrite("User::gsEmailMessage");
                Dts.VariableDispenser.LockForWrite("User::gsWebserviceName");
                Dts.VariableDispenser.LockForWrite("User::gsNoOfCallsInADay");
                Dts.VariableDispenser.LockForWrite("User::gsCalledBySystem");
                Dts.VariableDispenser.GetVariables(ref varCollection);
                //Set the header message for the query result
                if (varCollection["User::gsEmailMessage"].Value == string.Empty)
                    header = "Hi, Count is greater then 50 :\n\n";
                    //header = "Execute SQL task output sent using Send Email Task in SSIS:\n\n\n";
                    header += "----------------------------------------------------------------------------------------------------------------------" + "\n";
                    header += string.Format("{0}\t\t\t\t{1}\t\t{2}\n", "WebService Name", "No Of Calls In A Day", "Called By System");
                    header += "----------------------------------------------------------------------------------------------------------------------" + "\n";
                    varCollection["User::gsEmailMessage"].Value = header;
                //Format the query result with tab delimiters
                     message = String.Format("<HTML><BODY><P>{0}</P><P>{1}</P><P>{2}</P></BODY></HTML>",
                                            varCollection["User::gsWebserviceName"].Value,
                                            varCollection["User::gsNoOfCallsInADay"].Value,
                                            varCollection["User::gsCalledBySystem"].Value);
                varCollection["User::gsEmailMessage"].Value = varCollection["User::gsEmailMessage"].Value + message + "\n";
                Dts.TaskResult = (int)ScriptResults.Success;
    Above code will return data in below format and then i send this output in aemail using send mail task.
    Hi, count is greater then 50 :
    WebService Name                                                         
    No Of Calls In A Day                        Called By System
    WebServiceone                                                     1                             
    Internetbutiken
    WebServiceGetdetailstwo                                                  1                             
    Internetbutiken
    Servicenamethree                                                            2                             
    MOB
    As you can see above code is not in align as if we service name is shorter then 2nd column get disallign and its not look good.I need output should be like below.
    Hi, count is greater then 50 :
    WebService Name                                                         
    No Of Calls In A Day                        Called By System
    WebServiceone                                                              1                             
    Internetbutiken
    WebServiceGetdetailstwo                                              1                             
    Internetbutiken
    Servicenamethree                                                          2                             
    MOB
    Please suggest something...
    Thanks 
    SR_MCTS

    See code explained here
    http://microsoft-ssis.blogspot.in/2013/08/sending-mail-within-ssis-part-2-script.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
    This will not help.As I am not creating smtp connectin ,send from ,send to in script task.I am just creating email body from sql output.

  • How to add pl sql query into help text of an item.

    Hi
    In my database i have added comments to the colums. I would like to use this comments in the help text of the items of my application. I have the query but when I use it in the help text attribute it does not execute the query, it presents the query.
    Any ideas?

    It is probably too late now, but note that if you create your application using the Create Application Wizard and Application Models, based on User Interface Defaults created in the SQL Workshop, any column comments will automatically become application help text.

Maybe you are looking for

  • Apple DVI to Video adapter + Mini DVI to DVI adapter pins not same

    I just purchased an Apple DVI to Video adaptor so I could plug in a Mac mini to an older tv, however the pin arrangement on the Apple DVI to Video adapter is not the same as the pin arrangement on the Mini DVI to DVI adapter that came with the Mac mi

  • User status in Q-info record not updating on UD

    Hi All, My required scenario was, delivery of a material from a vendor must pass through inspection series u2022     Model u2022     Preliminary   u2022     Regular delivery  For that, 1). Maintain different inspection types (with corresponding task

  • Indesign CS3 - export to PDF and keep RGB colors

    I'm trying to export from InDesign to a pfd file that contains the original RGB colors of an imported image. The imported image is RGB and is from Illustrator CS3. I've tried changing the output color options in the export dialogue box but I can't se

  • Facebook video call don't work ?

    hi i just download apple os marvericks , and i find problem with video call in facebook , somebody can help me please to restart my video call en facebook

  • Zoom-in tool and selected objects

    Hi there, I am wondering about the possibility of making the zoom-in tool directs to the selected Object or Layer, and how that increase the accessibility with the shortcuts like CTRL+(+). Regards,