DATAEXPORT Command to SQL Table

Hi,
I've set up a backup routine to populate a SQL table with all Budget data for an overnight procedure.
When checking the resultant export I have found that I am getting two data columns and two of my dimensions are not passing members to the field in the table, one of which being Period which i find very strange.
I have the correct number of fields in the table to accept all the dimension members with a final field called Data. The resultant exported data sends values to the last two fields with the third last field is blank.
Code i have used is as follows:
SET DATAEXPORTOPTIONS
DataExportLevel ALL ;
DataExportDynamicCalc OFF;
DataExportColFormat OFF;
DataExportDimHeader ON;
FIX(@RELATIVE("Dept 119",0), @RELATIVE("Period",0), &Plan_Year1,&Curr_Scenario)
DATAEXPORT "DSN" "Datasource" "dbo.HYP_Data_BackUp_PandL" "**USER**" "**PASSWORD**";
ENDFIX
I would appreciate any help on this matter
Cheers
J

You too, huh?
I saw some very weird things go on with DATAEXPORT to SQL (Oracle something.something and was able to replicate it with SS 2005).
In addition to extra columns, I also saw very, very small (like -2.00E-15) numbers written where there should have been nothing (data was #Missing).
This did not happen with exports to flat files.
Was it me, the version of Essbase, the way I was trying to export data? I don't know -- I ran out of time to try every single possible combination of exporting and just wrote to a flat file that then had to be read into a table.
I was trying to export the results of upper level Accounts that were dynamically calculated and some upper level blocks.
Here was my code:
/*     Define data export options */
SET DATAEXPORTOPTIONS
     DATAEXPORTLEVEL "ALL" ;
     DATAEXPORTRELATIONALFILE ON ;
FIX(@LEVMBRS("Entity", 0), @LEVMBRS("Dim2", 0), @LEVMBRS("Dim3", 0), @LEVMBRS("Year", 0))
     DATAEXPORT "DSN" "XTest" "xportst" "id" "pwd" ;
ENDFIX
Regards,
Cameron Lackpour
P.S. On reflection, I realize that some of the DATAEXPORT calc scripts I wrote that wrote to tables worked just fine. They tended to be more tightly focused and limited. Perhaps there's a stack/memory issue going on?

Similar Messages

  • Dataexport to a relational table directly

    Hi,
    I am struggling to get the dataexport to directly add the data to the relational table.
    Have tried a bit and still failing.
    I have changed the fix in my calc script to just return a row but still failing. Here's my script which just returns one row in the text file shown below, but when I do dsn it never inserts the row to the sql table( my sql table has 21 columns and I have set them as varchar)
    Any ideas on how I can get it to work?
    SET DATAEXPORTOPTIONS
    DATAEXPORTDECIMAL 1;
    DataExportLevel "LEVEL0";
    DATAEXPORTOVERWRITEFILE ON;
    DataExportColFormat ON;
    DATAEXPORTCOLHEADER "Periods";
    FIX("FY2011","Budget","Version1",FixedAssets,"Amount","622185","3011","BU_None" ,@LEVMBRS(Periods,0) AND @DESCENDANTS(Annual,0),@LEVMBRS(Currencies,0));
    DATAEXPORT "File" "|" "BEAMtext2.txt";
    /*DATAEXPORT "DSN" "bfp" "ClaritydataCS.dbo.BEAM_Output_Budget" "bfpcssql" "pBaUsDsGwEoTrd123";*/
    ENDFIX;
    Output
    "M1"|"M2"|"M3"|"M4"|"M5"|"M6"|"M7"|"M8"|"M9"|"M10"|"M11"|"M12"
    "VERSION1"|"FixedAssets"|"Budget"|"USD"|"3011"|"622185"|"BU_None"|"Amount"|"FY2011"|274861.9|274861.9|274860.6|274860.6|274859.1|274675.0|274673.0|274672.6|274661.0|274655.7|274631.6|274631.3
    which is basically the 9 dimensions and 12 values for all 12 months

    When using the DATAEXPORT command to export data for direct insertion into a relational database:
    ● The table to which the data is to be written must exist prior to data export
    ● Table and column names cannot contain spaces
    Check with the below syntax.
    SET DATAEXPORTOPTIONS
    DATAEXPORTDECIMAL 1;
    DataExportLevel "LEVEL0";
    DATAEXPORTCOLHEADER "Periods";
    FIX("FY2011","Budget","Version1",FixedAssets,"Amount","622185","3011","BU_None" ,@LEVMBRS(Periods,0) AND @DESCENDANTS(Annual,0),@LEVMBRS(Currencies,0));
    DATAEXPORT "DSN" "bfp" "ClaritydataCS.dbo.BEAM_Output_Budget" "bfpcssql" "pBaUsDsGwEoTrd123";
    ENDFIX;

  • How to read excel file in document library and store excel content in sql table

    Hello,
    Can anyone help me how to read the excel file present in document library and store the content inside excel into sql table?
    Please let me know the ways to acheive this. Feel free to give your suggestions.
    Thanks,
    Cool Developer

    Hi!
    this code i have written becuase i donot find any soltions on net for this , u can try with this . :)
    System.Data.OleDb.
    OleDbConnection ExcelConnection = null;
    FileMode fileMode;
    string filePath = ConfigurationManager.AppSettings["TempLoaction"] + "\\" + fileName;
    using (SPSite _site = new SPSite(SPContext.Current.Web.Url))
    using (SPWeb _web = _site.OpenWeb())
    string docLibrary = ConfigurationManager.AppSettings["DocumentLibrary"];
    SPFile _file = _web.GetFile("/" + docLibrary + "/" + fileName);
    fileMode =
    FileMode.Create;
    byte[] byteArray = _file.OpenBinary();
    MemoryStream dataStream = new MemoryStream(byteArray);
    Stream stream = dataStream;
    using (FileStream fs = File.Open(filePath, fileMode))
    byte[] buffer = new byte[4096];
    int bytesRead;
    while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)
    fs.Write(buffer, 0, bytesRead);
    fs.Close();
    //Create the Connection String
    try
    string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;
    Data Source ='"
    + filePath + "'; Extended Properties=Excel 5.0";
    //Create the connection
    ExcelConnection =
    new System.Data.OleDb.OleDbConnection(ConnectionString);
    //create a string for the query
    string ExcelQuery;
    //Sheet1 is the sheet name
    //create the query:
    //read columns from the Excel file
    ExcelQuery =
    "Select * from [Sheet1$]"; // from Sheet1";
    //use "Select * ... " to select the entire sheet
    //create the command
    System.Data.OleDb.
    OleDbCommand ExcelCommand = new System.Data.OleDb.OleDbCommand(ExcelQuery, ExcelConnection);
    //Open the connection
    ExcelConnection.Open();
    //Create a reader
    System.Data.OleDb.
    OleDbDataReader ExcelReader;
    ExcelReader = ExcelCommand.ExecuteReader();
    //For each row after the first
    while (ExcelReader.Read())
    thanks,
    kshitij

  • Can't update a sql-table with a space

    Hello,
    In a transaktion I'm getting some Values from a SAP-ERP System via JCO.
    I update a sql-table with this values with a sql-query command.
    But sometimes the values I get from SAP-ERP are empty (space) and I'm not able to update the sql-table because of a null-value exception. (The column doesn't allow null-values). It seems that MII thinks null and space are the same.
    I tried to something like this when passing the value to the sql-query parameter but it didn't work:
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", " ")
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", " ")
    this works but I don't want to have a "_"
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", "_")
    Any suggestions?
    thank you.
    Matthias

    The problem is Oracle doesn't know the space function. But it knows a similar function: NVL --> replaces a null value with something else. So this statement works fine for me:
    update marc set
    LGort = '[Param.3]',
    dispo = '[Param.4]',
    schgt = NVL('[Param.5]', ' '),
    dismm = '[Param.6]',
    sobsl = NVL('[Param.7]',' '),
    fevor = '[Param.8]'
    where matnr = '[Param.1]' and werks = '[Param.2]'
    If Param.5 or Param.7 is null Oracle replaces it with a space in every other case it is the parameter itself.
    Christian, thank you for your hint with the space function. So I remembered the NVL-function.
    Regards
    Matthias

  • How to retrieve the values from PL/SQL table types.

    Hi Every one,
    I have the following procedure:
    DECLARE
    TYPE t1 IS TABLE OF emp%ROWTYPE
    INDEX BY BINARY_INTEGER;
    t t1;
    BEGIN
    SELECT *
    BULK COLLECT INTO t
    FROM emp;
    END;
    This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
    Can anybody help me please!!!!!
    Thanks
    Ahmed.

    You mean, you can't add this
    for i in t.first..t.last loop
    dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
    end loop;or you can't add this
    set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
    You see, not able like very similar it is not working - both are too vague...
    Best regards
    Maxim

  • Pl/sql table - row type records

    Hi,
    Is there any limit on the number of records that a pl/sql table (row type) can accomodate.Iam using oracle 10g

    user11200499 wrote:
    I have gone thru that url, nothing on the maximum number of records that can be present in pl/sql table is given there. Will be very helpful if you can let me know if there is any such limitation.There is no such thing as a PL/SQL "+table+". A table, in Oracle terminology, means colums and rows and indexes and the ability to scale data, effectively read and process and filter and aggregate data.
    A so-called PL/SQL "+table+" is nothing at all like this.
    The correct term for it, and used in all other programming languages, are arrays (procedural term) and collections (object orientated term).
    An array/collection is a local memory structure in the unit of code. In PL/SQL, that means PGA (process global area) memory. And as this uses server memory, you should not abuse it and only use as much that is truly needed.
    Make a PL/SQL array/collection too large, and PGA grows.. and can have a very negative impact on performance. It can even cause the server to crawl to halt, where you will struggle to enter a commandline command on the server as it is spending 99% of CPU time trying to deal with memory requests and page swapping.
    So what do we then use arrays/collections for in PL/SQL?
    For the very same reason we use in any other programming language - dealing with managing local programming data in a more effective memory structure. Such as bulk processing when requiring a buffer variable that can be passed to and from the PL and SQL engines.
    This does NOT mean using it as you would use it as if it is a SQL table. As it is not.
    So to answer your question of how large a PL/SQL array or collection can be? That depends entirely on the problem you are trying to solve. If it is for example bulk processing, then typically a collection of a 100 rows provides the best balance between the amount of (expensive) PGA memory being used versus the increase in performance by reducing context switching between the PL and SQL engines.
    If the rows are quite small, perhaps even a 1,000 row collection. More than that seldom decreases context switching enough to justify the increase in expensive PGA.
    So what should then be used to store larger data structures in PL/SQL? GTT or Global Temporary Tables. As this is a proper SQL table structure. Can be indexed. Natively supports SQL. Can scale with data volumes.
    And most importantly, it does not consume dedicated process memory and will not blow server memory.

  • REPORT ON PL/SQL TABLE OF RECORDS  on 6i & 9i

    HELLO ALL,
    I Want to know if it is posible to build a report on pl/sql
    table of records in developer 6i, or in 9i.
    thanks

    This should not happen. If you are not sure that your stored procedure is bug-free, you could generate and use stored procedures using my SQLPlusPlus and give it a try.
    You can email me directly if your problem still not gets solved.
    regards,
    M. Armaghan Saqib
    +---------------------------------------------------------------
    | 1. SQL PlusPlus => Add power to SQL Plus command line
    | 2. SQL Link for XL => Integrate Oracle with XL
    | 3. Oracle CBT with sample GL Accounting System
    | Download free: http://www.geocities.com/armaghan/
    +---------------------------------------------------------------
    null

  • Copy command in SQL

    What is the Copy Command in SQL ?

    COPY Command is used to COPY database table from one Schema to another Schema.

  • The data from my web page insert in SQL table as question marks

    I use Farsi language in my web page for inserting customer data. The data that is inserted in webpage and submitted, showed as ???? in SQL table. A lot of developers say that I should use N' before the Unicode character, but I don't know how I can use it
    in my code. I attached the code. Can someone say me where I should insert the N in my code?
    protected void cmdInsert_Click(object sender, EventArgs e)
    //Checking the validation of required fields
    if (cboCustomerType.Text == "" || cboTitle.Text == "" || SearchableName.Text == "" ||
    FinalName.Text == "" || NationalID.Text == "" || BusinessID.Text == "" || MobilePhone.Text == "")
    lblStatus.Text = "لطفا فیلدهای اجباری را حتما پر کنید";
    return;
    //define ADO.NET objects.
    string insertSQL;
    insertSQL = "INSERT INTO Customers(";
    insertSQL += "CustomerType,CustomerTitle,CustomerFirstName,CustomerLastName,CompanyType,";
    insertSQL += "CompanyName,SearchableName,FinalName,NationalCode,BusinessID,City,Address,PostalCode,";
    insertSQL += "Zone,MobileNumber,WorkPhone1,WorkPhone2,HomePhone,FaxNumber,Email,Website,Note)";
    insertSQL += "VALUES('";
    insertSQL += cboCustomerType.Text + "','";
    insertSQL += cboTitle.Text + "','";
    insertSQL += CustomerFirstName.Text + "','";
    insertSQL += CustomerLastName.Text + "','";
    insertSQL += cboCompanyType.Text + "','";
    insertSQL += CompanyName.Text + "','";
    insertSQL += SearchableName.Text + "','";
    insertSQL += FinalName.Text + "','";
    insertSQL += NationalID.Text + "','";
    insertSQL += BusinessID.Text + "','";
    insertSQL += City.Text + "','";
    insertSQL += Address.Text + "','";
    insertSQL += PostalCode.Text + "','";
    insertSQL += Zone.Text + "','";
    insertSQL += MobilePhone.Text + "','";
    insertSQL += Phone1.Text + "','";
    insertSQL += Phone2.Text + "','";
    insertSQL += HomePhone.Text + "','";
    insertSQL += FaxNumber.Text + "','";
    insertSQL += Email.Text + "','";
    insertSQL += Website.Text + "','";
    insertSQL += Note.Text + "')";
    SqlConnection con = new SqlConnection(connectionString);
    SqlCommand cmd = new SqlCommand(insertSQL, con);
    //try to open the database and execute the insert
    int added = 0;
    try
    con.Open();
    added = cmd.ExecuteNonQuery();
    lblStatus.Text = added.ToString() + "اضافه شد";
    catch (Exception err)
    lblStatus.Text = "Error inserting record.";
    lblStatus.Text += err.Message;
    finally
    con.Close();
    //If the insert succeed, refresh the customer list.
    if (added > 0)
    FillCustomerList();
    Regards,

    Because you're composing the SQL statement with string concatenation, you would put the "N" before the single quote,
    VALUES(N'";
                insertSQL += cboCustomerType.Text + "',N'";
                insertSQL += cboTitle.Text + "',N'"; // ...etc
    However, composing SQL statements with string concatenation is not a suggested practice because it's open to SQL injection (see:
    https://technet.microsoft.com/en-us/library/ms161953(v=sql.105).aspx). A safer way to do this is to use command parameters to represent the values (see SqlCommand.Parameters
    property). If you use parameters, you can specify parameter data type as SqlDbType.NVarchar, which will ensure your text values are passed in as Unicode. Also ensure that the columns in question are defined in the database table definition as Unicode (NVARCHAR
    rather than VARCHAR).
    Hope this helps, Bob

  • Need to format a vpn log text file into a format that can be written directly to a SQL table

    I am trying to do two thing inside of powershell
    1. Take a vpnlog text file  "C:\temp\ps3\vpnlogs\testlog.txt" formatted as such and be able to directly add the columns to a sql table
    "Number" "Date" "Time" "Interface" "Origin" "Type" "Action" "Service" "Source Port" "Source" "Destination" "Protocol" "Rule"
    "Rule Name" "Current Rule Number" "User" "Information" "Product" "Source Machine Name" "Source User Name"
    "291" "29Nov2013" "23:59:00" "" "A*****" "Log" "Log In" "" "" "111.*.*.* " "A*****" "" "" "" "" "pet*******"
    "VPN internal source IP: 192.*.*.*; reason: disconnected from gateway" "Security Gateway/Management" "" ""
    2. Remove the empty colums in this text file so that I can then find a way to upload only colums that have a column name directly up to the sql table via a powershell script .
    SO basically import txt file format it into colums that have data that can then be directly written to a sql table without me having to manually create the columns in the table. if this worked correctly the sql table would be uploaded with the colums and
    data from sql.
    I can do the upload portion with the below listed powershell command however when I import the following file into powershell I have to manually import the testlog.txt into excel then save as a csv to upload... not to mention I had to
    manually create the columns in the sql table so that it imports correctly.
    get-content "C:\temp\ps3\vpnlogs\testlog.txt" I can not get the data to format correctly without manually importing it into the logfiledata.csv.
    $dt=Import-Csv-Path"C:\temp\ps3\vpnlogs\logfiledata.csv"|Out-DataTable
    Write-DataTable -ServerInstance"myserver"-Database"mydata"-TableName"dbo.VPNLOGS"-Data$dt
    I also have tried this to format the text file but it's not working the way I thought it should, but I don't want to have to create the .CSV file if I can avoid it I would rather take the data in powershell formatted and use the colums to
    get-content"C:\temp\ps3\vpnlogs\testlog.txt"|Foreach-Object{
    ($_ 
    -replace'"',',')
    } |Set-Content"C:\temp\ps3\vpnlogs\testlog2.csv"
    | Import-Csv
    "C:\temp\ps3\vpnlogs\testlog2.csv"|selectNumber,date,time,interface,origin,type,action,service,"source
    port",source,destination,protocol,rule,"rule
    name","current
    rule number",user,information,product,"source
    machine name","source
    user name"
    "Number" "Date" "Time" "Interface" "Origin" "Type" "Action"
    "Service" "Source Port" "Source" "Destination" "Protocol" "Rule" "Rule Na
    me" "Current Rule Number" "User" "Information" "Product" "Source Machine Name" "Source User Name"
    "473" "4Dec2013" "23:59:01" "" "AAMESXF604" "Log" "Log In" "" "" "ip72-198-30-53.ok.ok.cox.net" "AAMESXF604" "" "" ""
    "" "usthompst"

    Thank you Mjolinor this seems to have given me a good output, now do you know of a method using the out-datable  and write-datatable that I can use to directly upload the objects and data. Really I do not want to have to create another file at this
    point I would like to take all of this info and now write it directly to my SQL-Table...
       TypeName: Selected.System.Management.Automation.PSCustomObject
    Name                MemberType   Definition                                                                                       
    Equals              Method       bool Equals(System.Object obj)                                                                   
    GetHashCode         Method       int GetHashCode()                                                                                
    GetType             Method       type GetType()                                                                                   
    ToString            Method       string ToString()                                                                                
    Action              NoteProperty System.String Action=Log In                                                                      
    Current Rule Number NoteProperty System.String Current Rule Number=                                                               
    Date                NoteProperty System.String Date=4Dec2013                                                                      
    Destination         NoteProperty System.String Destination=******                                                          
    Information         NoteProperty System.String Information=VPN internal source IP: *.*.*.*; reason: disconnected from gateway
    Interface           NoteProperty System.String Interface=                                                                         
    Number              NoteProperty System.String Number=473                                                                         
    Origin              NoteProperty System.String Origin=********                                                                  
    Product             NoteProperty System.String Product=Security Gateway/Management                                                
    Protocol            NoteProperty System.String Protocol=                                                                          
    Rule                NoteProperty System.String Rule=                                                                              
    Rule Name           NoteProperty System.String Rule Name=                                                                         
    Service             NoteProperty System.String Service=                                                                           
    Source              NoteProperty System.String Source=ip*-*-*-*.ok.ok.cox.net                                                
    Source Machine Name NoteProperty System.String Source Machine Name=                                                               
    Source Port         NoteProperty System.String Source Port=                                                                       
    Source User Name    NoteProperty System.String Source User Name=                                                                  
    Time                NoteProperty System.String Time=23:59:01                                                                      
    Type                NoteProperty System.String Type=Log                                                                           
    User                NoteProperty System.String User=*******  

  • Set substitution variable from Sql table

    Hi guys,
    I am new to sql/unix so I hope you can guide me in the right direction.
    whats the easiest way to update an essbase subvar from a sql table?
    would I have to write a sqlplus statement to output the variable to file,
    read the file in a maxl command and set the variable and call these commands using .sh script and esscmd?
    is there a more efficient way to set the variable? e.g only use sqlplus and esscmd?
    thanks in advance,

    Try something like this
    echo off
    sqlplus -s username/passwordusername/password@server/SID:@server/SID:port @test.sql > variable.txt
    for /f "usebackq delims=" %%a in (variable.txt) do set CurrentMonth=%%a
    echo %CurrentMonth%
    See whether you are getting the correct month.
    Regards
    Celvin
    http://www.orahyplabs.com

  • PL/SQL tables

    Hi,
    I've created some code that uses PL/SQL type of OBJECT. I used an
    example I found. The code works fine, but I am trying to understand
    exactly 'how' it works. Please see this:
    create TYPE article_record_type AS OBJECT
    (username VARCHAR2(30),
    user_id NUMBER,
    article_id NUMBER,
    teaser_subject VARCHAR2(2000),
    teaser_message CLOB,
    total_articles NUMBER);
    create TYPE article_table_type IS TABLE OF article_record_type;
    FOR v_rec IN commentary_data(v_author_id, v_num_articles) LOOP
    v_article_record.EXTEND(1);
    v_sub := v_sub + 1;
    v_article_record(v_sub) := article_record_type(v_rec.username,
    v_rec.user_id, v_rec.article_id,
    v_rec.teaser_subject, v_rec.teaser_message,
    v_rec.total_articles);
    END LOOP;
    OPEN p_data FOR SELECT * FROM TABLE (CAST (v_article_record AS
    article_table_type));
    My confusion this this: I understand the CREATE TYPE commands. I
    understand v_article_record being a table of article_table_type which
    is in itself a record of article_record_type.
    But where I assign values to v_article_record(v_sub), I do not
    understand how the values in article_record_type get there?
    v_article_record(v_sub) := article_record_type(v_rec.username,
    v_rec.user_id, v_rec.article_id,
    v_rec.teaser_subject, v_rec.teaser_message,
    v_rec.total_articles);
    article_record_type(v_rec.username.........
    If v_article_record is of type article_table_type which is a table of
    article_record_type, then why can't I use say:
    articlerecord(v_sub).username := v_rec.username. Why does it have
    to be inside article_record_type.
    I'm just trying to see how Oracle is relating all of this and how it
    works and how the values relate to the OBJECT and such.
    Thanks!
    Sandeep

    First off, there is no such thing as a PL/SQL "+table+". It is a pet peeve of mine - as the correct term for that structure is either an array or a collection. It is nothing at all like a table, and gives the misguided perception that it can be used as, and instead of, a real table. It cannot.
    User defined types in Oracle is very much the same as object class definitions in o-o languages like Java, Delphi and C#.
    When you create an object type like article_record_type - a bad choice for a name by the way as this in not a record type that you define, but an object type...
    Anyway, when you define the object type, it is in fact like defining an object class. A class has a constructor. This constructor is used to instantiate (create) objects of that class.
    There is a default constructor for an Oracle object type. This is the name of the object type (or class), followed by the properties defined for that. E.g.
    Default constructor:
       <name_of_type> ( <property1> [, <property-n> ] )
    Example:
      article_record_type( username, user_id, article_id, teaser_subject,  teaser_message, total_articles )To use this constructor to instantiate an object, you define an object variable and assign the constructor to it. E.g.
    declare
      myArticle article_record_type;
    begin
      myArticle := new article_record_type( 'John', 1, 10, 'Some subject',  null, 0 );
    end;You can also store a bunch of objects in an array - or more correctly termed a collection. For this you need to define a "+table type+" class - or more correctly termed, a collection class.
    This class can collect/contain multiple objects. It also has a constructor. It also has class methods called Count(), Extend() and so on.
    You can also define your own class methods, functions and custom constructors for your Oracle object types.
    Last comment. Review your standards for naming classes and class properties. Do not fall in the trap of twisted and warped standards so many use for Oracle. Objects should be defined using pascal case. Properties should be defined using camel case. Methods and constructors should be defined using pascal case. Underscores are not used (and this makes for a better scope resolution when dealing with SQL data columns that do use underscores as different standards are used for SQL).
    Please do yourself a huge favour and look at the de-facto programming standards for the vast majority of modern programming languages used today - and how and where and when to use lowercase, pascal case and camel case. And apply these to the PL language and object type definitions in Oracle.

  • Returning multiple pl/sql tables to VB using ADO + Oracle's OLE DB

    Windows XP
    VB 6
    ADO 2.7
    Oracle 9i Client (OLE DB 9.2.0.1)
    Oracle DB 8.1.7.2
    I have just upgraded a VB5/NT (RDO + MS ODBC for Oracle) app to VB6/XP (ADO + Oracle's OLE DB). The calls to stored procedures that returns tables are not working now. I get following error:
    -214721900 ORA-06550: line 1, column 42:
    PLS-00201:identifier 'LO_AUDIT_ID_TBL' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Please provide hint/help.

    Yes, the LO_AUDIT_ID_TBL is a variable (of table type) being returned from the stored procedure.
    I tried changing case of table is in pl/sql.
    I tried removing the table(s) from the Call statement...
    and I get error message that there are missing parameters.
    THANKS SO MUCH FOR YOUR HELP.
    I have been reading OLE DB User's guide in which there are examples of Ref Cursors and has no documentation regarding how to achieve same using tables (in stead of Ref Curs). I am also looking for documentation that would describe all different Registry attributes that could be turned on or off to do things, but have not been able to find any.
    I am trying to use the PLSQLRSet to retrieve rowsets from pl/sql tables. You can see that in my VB code below, in GetSPResultSet function.
    The VB Code is:
    Public Function Retrieve() As ADODB.Recordset
    Dim inparam(-2 To -1) As Variant 'set to be ignored by GetSPResultSet method
    Dim outparam(0) As Variant
    Dim strSQL As String
    strSQL = "{ CALL PckPLAudit.Sel_Smmry( ?,{resultset 1000, lo_audit_id_tbl, lo_audit_dt_tbl, lo_audit_type_tbl, " & _
    "lo_audit_status_tbl, lo_qty_selected_tbl, lo_qty_deselect_tbl, lo_qty_sent_tbl, lo_qty_follow_tbl, " & _
    "lo_qty_received_tbl, lo_qty_ncpl_tbl, lo_qty_security_tbl, lo_qty_closed_tbl, lo_qty_sentsec_tbl}, {resultset 1, lo_res_tbl} ) }"
    Set rdoRs = mConnection.GetSPResultSet(strSQL, inparam(), outparam())
    BuildCollection
    Set Retrieve = rdoRs
    End Function
    Public Function GetSPResultSet(ByVal szSQL As String, InParam() As Variant, OutParam() As Variant) As ADODB.Recordset
    '============================================================================
    'submits a call to a stored procedure that returns table output parameters.
    'out params are interpreted as ADODB.Recordset
    'szSQL : SQL call to stored procedure
    'InParam() : array of input parameter values
    'OutParam() : array of output parameter values set in this function
    '============================================================================
    Dim qry As New ADODB.Command
    Dim ParamIn As ADODB.Parameter
    Dim ParamOut As ADODB.Parameter
    Dim RS As ADODB.Recordset
    Dim inti As Integer
    Dim intj As Integer
    Dim blnret As Boolean
    Dim mErrors As New cErrors
    Dim retVal As Double
    'Dim itmp As Integer
    Dim ParmType As DataTypeEnum
    Dim i
    On Error GoTo errGetSPResultSet
    blnret = True
    Set qry = New ADODB.Command
    qry.ActiveConnection = mrdoCn
    qry.CommandType = adCmdText
    qry.CommandText = szSQL
    'load rdoParameter object(s) from InParam array if InParam exists
    For inti = 0 To UBound(InParam)
    'qry.Parameters(i).Value = InParam(inti)
    Set ParamIn = New ADODB.Parameter
    Select Case TypeName(InParam(inti))
    Case "Integer"
    ParmType = adDouble
    Case "Double"
    ParmType = adDouble
    Case "String"
    ParmType = adChar
    Case "Null"
    ParmType = adDouble
    Case "Date"
    ParmType = adDate
    Case "Long"
    ParmType = adDouble 'jks 12/19/2002
    End Select
    Set ParamIn = qry.CreateParameter(ParamIn, ParmType, adParamInput)
    ParamIn.Value = InParam(inti)
    If TypeName(InParam(inti)) = "Null" Then
    ParamIn.Size = 0
    Else
    ParamIn.Size = Len(InParam(inti))
    End If
    qry.Parameters.Append ParamIn
    Next
    For intj = 0 To UBound(OutParam)
    Set ParamOut = New ADODB.Parameter
    Select Case TypeName(OutParam(intj))
    Case "Integer"
    ParmType = adDouble
    Case "Double"
    ParmType = adDouble
    Case "String"
    ParmType = adChar
    Case "Null"
    ParmType = adEmpty
    Case "Empty"
    ParmType = adDouble
    Case "Date"
    ParmType = adDate
    Case "Long"
    ParmType = adDouble 'jks 12/19/2002
    End Select
    Set ParamOut = qry.CreateParameter(ParamOut, ParmType, adParamOutput, 255)
    qry.Parameters.Append ParamOut
    Next
    'execute the stored procedure call
    qry.Properties("PLSQLRSet") = True
    Set RS = qry.Execute() 'rdOpenStatic, rdConcurReadOnly
    qry.Properties("PLSQLRSet") = False'
    For intj = 0 To UBound(OutParam)
    OutParam(intj) = qry.Parameters.Item(inti)
    inti = inti + 1
    Next
    If OutParam(0) <> 0 Then
    If OutParam(0) = 999 Then
    i = mErrors.DisplayError(Val(OutParam(0)), "SAM")
    Else
    MsgBox "Database returned error code " & OutParam(0) & "." & vbCrLf & " Unable to complete operation. "
    End If
    blnret = False
    End If
    If blnret Then
    Set GetSPResultSet = RS
    Else
    Set GetSPResultSet = Nothing
    End If
    Set RS = Nothing
    Set qry = Nothing
    Set ParamIn = Nothing
    Set ParamOut = Nothing
    exitGetSPResultSet:
    Exit Function
    errGetSPResultSet:
    blnret = ProcessError(Err)
    If Not blnret Then Set GetSPResultSet = Nothing
    Resume exitGetSPResultSet
    End Function
    The stored procedure is:
    CREATE OR REPLACE PACKAGE BODY D5750PGM.PckPLAudit IS
    PROCEDURE Sel_Smmry (
         lo_res_cd          out     number,
         LO_AUDIT_ID_TBL          out     pckclaudit.audit_id_tbl%type,
         lo_audit_dt_tbl          out     pckclaudit.audit_dt_tbl%type,
    lo_audit_type_tbl     out     pckclaudit.audit_type_tbl%type,
         lo_audit_status_tbl     out     pckclaudit.audit_status_tbl%type,
         lo_qty_selected_tbl     out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_qty_deselect_tbl     out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_qty_sent_tbl          out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_qty_follow_tbl     out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_qty_received_tbl     out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_qty_ncpl_tbl          out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_qty_security_tbl     out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_qty_closed_tbl     out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_qty_sentsec_tbl     out     pckclaudit.audit_smmry_qty_tbl%type,
         lo_res_tbl          out     pcktbtable_type.res_tbl%type
    IS
    BEGIN
         PckAudit.Sel_Smmry (pckclglobal.lg_pl_proc, lo_res_cd,
         lo_audit_id_tbl,
         lo_audit_dt_tbl,
    lo_audit_type_tbl,
         lo_audit_status_tbl,
         lo_qty_selected_tbl,
         lo_qty_deselect_tbl,
         lo_qty_sent_tbl,
         lo_qty_follow_tbl,
         lo_qty_received_tbl,
         lo_qty_ncpl_tbl,
         lo_qty_security_tbl,
         lo_qty_closed_tbl,
         lo_qty_sentsec_tbl,
         lo_res_tbl
    END Sel_Smmry;
    END PckPLAudit;
    also, pckclaudit.audit_id_tbl%type is defined as
    TYPE audit_id_tbl_type IS TABLE OF disb_audit.disb_audit_id%TYPE
         INDEX BY BINARY_INTEGER ;
    and disb_audit.disb_audit_id%TYPE is defined as
    CREATE TABLE D5750.DISB_AUDIT
    DISB_AUDIT_ID NUMBER(9,0) NOT NULL,
    AUDIT_DT DATE NOT NULL,
    AUDIT_CODE_TYPE_ID VARCHAR2(5) NOT NULL,
    AUDIT_CODE_ID VARCHAR2(2) NOT NULL,
    CRTN_ID VARCHAR2(8) NOT NULL,
    CRTN_DT_TM DATE NOT NULL,
    etc.

  • SQL Bulk Update using Update query in SQL Table

    Hello All,
    I want to update data in sql table depends on some condition.
    I am getting excel sheet from client and want to change value of field say Status = c.
    Client is sending excel sheet with 300 field and want to change value for all 300 records with unique fields (field1 and field2) comming in that excel sheet...
    How can i write and update records as Bulk.
    Instaed updating one one recors ?
    Example ( Update Table_Name Set Status = 'c' Where Field1 = Value from Excel for Field1 and
    Field2 = Value from Excel for Field2 )
    Same needs to do for 300 records...
    Any help will wellcome.
    Thanks,
    Nilesh....
    Thanks and Regards, Nilesh Thakur.

    you can use OPENROWSET for that
    http://www.mssqltips.com/sqlservertip/1540/insert-update-or-delete-data-in-sql-server-from-excel/
    Another way is to use SSIS with data flow task having Excel source connecting to excel and using OLEDB command to update rows in table using it. You may also use staging table to get data from excel and later use it inexecute sql task to update your table
    to make update set based which would be faster.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Oracle datalinks to update a MS SQL table

    I am accessing a MS SQL table thru an Oracle procedure. Reads with no problems. When I try and update a column (2 columns affected one is a int and the other is datetime) receive the following error:
    ORA-02070: database IWSCIV does not support || in this context
    Sql Statements tried are
    UPDATE iwPhotoProcessed@IWSCIV
    SET "Status" = 1
    where "BKno" = '1' || v_app_id;
    UPDATE iwPhotoProcessed@IWSCIV
    SET "Status" = 1, CompletedDate='04/05/2008 09:14:15 AM'
    where "BKno" = '1' || v_app_id;
    The above command (minus the @IWSCIV) works fine in MS SQL and updates rows.

    1) I would generally suggest avoiding string literals when doing UPDATE statements in general, but particularly in the case of updates across Heterogeneous Connectivity database links.
    2) I would generally write something like this (assuming "BKno" is declared as a string)
    DECLARE
      l_new_status NUMBER := 1;
      l_app_id VARCHAR2(10) := '1' || v_app_id;
    BEGIN
      UPDATE iwPhototProcessed@IWSCIV
         SET "Status" = l_new_status
       WHERE "Bkno" = l_app_id;
    END;Justin

Maybe you are looking for

  • View multiple months in iCal?

    When in month view, I want to be able to view more than one month at a time (i.e. the last half of September and the first half of October; or view September and October at the same time). This seems like it should be relatively easy. It is in Entour

  • Vista 64 bit Itunes crashes on Install (over and over again!)

    Does anyone know how I can get the old version of Itunes that worked just fine? The new Itunes download fo Vista 64 bit keeps crashing and I've lost $50 worth of downloads.

  • Ignore record in JMS sender content conversion

    Hi, I am using JMS sender adapter with content conversion. In the input text file, I have to ignore the first record. for this, in Module tab I have given parameter like this: Plain2XML -> documentOffset -> 1 so that it will not read the first record

  • OBIEE11g: download report in pipeline (|) or charat (^) delimiter format

    Hi, Need help with following customer queries for OBIEE 11g: Can a report be downloaded in pipeline (|) delimiter format or charat (^) delimiter format. There was a Bug 12403932 : CUSTOMIZE DOWNLOAD FORMAT. Is it fixed in the 11.1.1.5? Thanks & Regar

  • FM for Payment Release in FB03

    Hello, Does anyone know a FM that can be used to make payment release by FB03? I need to make a change in payment WF, so that when you reach the stage of payment release, do not open the screen of the FB03. Regards, Balbino Soares