Not able to retrive the recordset from oracle stored procedure in VC++

Hi,
I am trying to retrieve the records from the reference cursor which is an out parameter for an oracle 9i store procedure in VC++ application. But it is giving the record count as -1 always. Meanwhile i am able to get the required output in VB application from the same oracle 9i store procedure .
Find the code below which i used.
Thanks,
Shenba
//// Oracle Stored Procedure
<PRE lang=sql>CREATE OR REPLACE
PROCEDURE GetEmpRS1 (p_recordset1 OUT SYS_REFCURSOR,
p_recordset2 OUT SYS_REFCURSOR,
PARAM IN STRING) AS
BEGIN
OPEN p_recordset1 FOR
SELECT RET1
FROM MYTABLE
WHERE LOOKUPVALUE > PARAM;
OPEN p_recordset2 FOR
SELECT RET2
FROM MYTABLE
WHERE LOOKUPVALUE >= PARAM;
END GetEmpRS1;</PRE>
///// VC++ code
<PRE lang=c++ id=pre1 style="MARGIN-TOP: 0px">ConnectionPtr mpConn;
_RecordsetPtr pRecordset;
_CommandPtr pCommand;
_ParameterPtr pParam1;
//We will use pParam1 for the sole input parameter.
//NOTE: We must not append (hence need not create)
//the REF CURSOR parameters. If your stored proc has
//normal OUT parameters that are not REF CURSORS, you need
//to create and append them too. But not the REF CURSOR ones!
//Hardcoding the value of i/p paramter in this example...
variantt vt;
vt.SetString("2");
m_pConn.CreateInstance (__uuidof (Connection));
pCommand.CreateInstance (__uuidof (Command));
//NOTE the "PLSQLRSet=1" part in
//the connection string. You can either
//do that or can set the property separately using
//pCommand->Properties->GetItem("PLSQLRSet")->Value = true;
//But beware if you are not working with ORACLE, trying to GetItem()
//a property that does not exist
//will throw the adErrItemNotFound exception.
m_pConn->Open (
bstrt ("Provider=OraOLEDB.Oracle;PLSQLRSet=1;Data Source=XXX"),
bstrt ("CP"), bstrt ("CP"), adModeUnknown);
pCommand->ActiveConnection = m_pConn;
pParam1 = pCommand->CreateParameter( bstrt ("pParam1"),
adSmallInt,adParamInput, sizeof(int),( VARIANT ) vt);
pCommand->Parameters->Append(pParam1);
pRecordset.CreateInstance (__uuidof (Recordset));
//NOTE: We need to specify the stored procedure name as COMMANDTEXT
//with proper ODBC escape sequence.
//If we assign COMMANDTYPE to adCmdStoredProc and COMMANDTEXT
//to stored procedure name, it will not work in this case.
//NOTE that in the escape sequence, the number '?'-s correspond to the
//number of parameters that are NOT REF CURSORS.
pCommand->CommandText = "{CALL GetEmpRS1(?)}";
//NOTE the options set for Execute. It did not work with most other
//combinations. Note that we are using a _RecordsetPtr object
//to trap the return value of Execute call. That single _RecordsetPtr
//object will contain ALL the REF CURSOR outputs as adjacent recordsets.
pRecordset = pCommand->Execute(NULL, NULL,
adCmdStoredProc | adCmdUnspecified );
//After this, traverse the pRecordset object to retrieve all
//the adjacent recordsets. They will be in the order of the
//REF CURSOR parameters of the stored procedure. In this example,
//there will be 2 recordsets, as there were 2 REF CURSOR OUT params.
while( pRecordset !=NULL ) )
while( !pRecordset->GetadoEOF() )
//traverse through all the records of current recordset...
long lngRec = 0;
pRecordset = pRecordset->NextRecordset((VARIANT *)lngRec);
//Error handling and cleanup code (like closing recordset/ connection)
//etc are not shown here.</PRE>

It can be linked to internal conversion. In some case, the value of internal or extranal value is not the same.
When you run SE16 (or transaction N), you have in option mode the possibility to use the exit conversion or not.
Christophe

Similar Messages

  • The problem here is i am not able to get the data from the list

    hi all,
    i have the following code
    EnrichedProductCatalogue enrichedProductCatalogue1 = new EnrichedProductCatalogue();
    enrichedProductCatalogue1.setAssetCount(2);
    enrichedProductCatalogue1.setBlockingProduct("Weekend Freebee");
    enrichedProductCatalogue1.setBlockingReason("Compatability");
    ArrayList<String> availableActionsList = new ArrayList<String>();
    availableActionsList.add(EnrichedProductConstants.ADD.toString());
    availableActionsList.add(EnrichedProductConstants.REMOVE.toString());
    enrichedProductCatalogue1.setAvailaibleActions((ArrayList<String>)availableActionsList);
    BundleProduct bundleProduct = null;
    Product product = new Product();
    product = new Product();
    product.setProductName("International");
    product.setProductClassName("International");
    ArrayList<UiCategory> uiCategory = new ArrayList<UiCategory>();
    UiCategory uiCategory1 = new UiCategory();
    uiCategory1.setCategoryName("Simply");
    UiCategory uiCategory2 = new UiCategory();
    uiCategory2.setCategoryName("Freebees");
    uiCategory.add(uiCategory1);
    uiCategory.add(uiCategory2);
    product.setUiCategory(uiCategory);
    bundleProduct = new BundleProduct();
    bundleProduct.setCommercialProduct(product);
    enrichedProductCatalogue1.setBundleProduct(bundleProduct);
    listOfEnrichProducts.add(enrichedProductCatalogue1);
    listOfEnrichProducts.add(enrichedProductCatalogue1);
    here i have an list called listOfEnrichProducts.
    here i am adding two objects of enrichedProductCatalogue.
    which contains a object called BundleProduct.
    which has a reference for Product class.
    here this product class has a list which contains objects of another class called UiCategory.
    the problem here is i am not able to get the data from the list which contains UiCategory objects .
    the following is the UI
    <af:table var="row" rowBandingInterval="0" id="t1"
    value="#{pageFlowScope.sample1}"
    binding="#{pageFlowScope.sampleManagedBean.dataTable}"
    partialTriggers="apimethods ::apimethods">
    <af:column sortable="false" headerText="ProductName" id="c2">
    <af:outputText value="#{row.bundleProduct.commercialProduct.productName}" id="ot15"/>
    </af:column>
    <af:column sortable="false" headerText="ProductClass" id="c12">
    <af:outputText value="#{row.bundleProduct.commercialProduct.productClassName}" id="ot19"/>
    </af:column>
    <!--
    <af:column sortable="false" headerText="UICategoryName" id="c32">
    <af:forEach var="item" items="#{row.bundleProduct.commercialProduct.uiCategory}" >
    <af:outputText value="#{item.categoryName}" id="ot119"/>
    </af:forEach>
    </af:column>
    -->
    <af:column sortable="false" headerText="AssetCount" id="c22">
    <af:outputText value="#{row.assetCount}" id="ot1"/>
    </af:column>
    <af:column sortable="false" headerText="blockingReason" id="c3">
    <af:outputText value="#{row.blockingReason}" id="ot2"/>
    </af:column>
    <af:column sortable="false" headerText="blockingProduct" id="c4">
    <af:outputText value="#{row.blockingProduct}" id="ot3"/>
    </af:column>
    <!--<af:column sortable="false" headerText="availaibleActions" id="c1">
    <af:commandButton text="#{row.availaibleActions}" id="cb1"
    actionListener="#{pageFlowScope.sampleManagedBean.callAction}"
    partialSubmit="true">
    <af:setPropertyListener from="#{row.availaibleActions}"
    to="#{pageFlowScope.avalibleaction}" type="action"/>
    </af:commandButton>
    </af:column>-->
    </af:table>
    Can anyone pls give some solution ...

    Hi Frank,
    value="#{pageFlowScope.sample1}"
    here sample is
    Map<String, Object> flowScope1 =
    ADFContext.getCurrent().getPageFlowScope();
    flowScope.put("sample1", listOfEnrichProducts);
    this is not the problem . i am able to get all the values except the following .
    ArrayList<UiCategory> uiCategory = new ArrayList<UiCategory>();
    UiCategory uiCategory1 = new UiCategory();
    uiCategory1.setCategoryName("Simply");
    UiCategory uiCategory2 = new UiCategory();
    uiCategory2.setCategoryName("Freebees");
    uiCategory.add(uiCategory1);
    uiCategory.add(uiCategory2);
    product.setUiCategory(uiCategory);

  • PI is not able to pick the file from the FTP folder

    This is the FILE TO IDOC scenario. We have configured the file adapter. But its not able to pick the file from the specified directory. We have tried changing the transfer mode from Binary to Txt & also we have tried to put advance selection for source file but it didn't work. Its throwing the below error:
    PI Adapter Log:
    An error occurred while connecting to the FTP server '10.130.150.21:8529'. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 451 Unexpected reply coderequested action aborted: local error in processing'. For details, contact your FTP server vendor.
    Also we have contacted the FTP team & they told that PI is sending an unsupported command. So instead of taking the file TLOG.txt, its treating this file name a s a directory. Please find the logs from FTP end below:
    FTP Log:
    (207197)2/5/2013 14:48:25 PM - sysisappi (63.130.82.16)> 230 Logged on
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> FEAT
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 211-Features:
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  MDTM
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  REST STREAM
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  SIZE
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  MLST type*;size*;modify*;
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  MLSD
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  AUTH SSL
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  AUTH TLS
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  PROT
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  PBSZ
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  UTF8
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  CLNT
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  MFMT
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 211 End
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> PBSZ 0
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 200 PBSZ=0
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> PROT P
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 200 Protection level set to P
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> CWD /Qas
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 250 CWD successful. "/Qas" is current directory.
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> CWD SAP_ORION
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 250 CWD successful. "/Qas/SAP_ORION" is current directory.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> CWD Inbound
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 250 CWD successful. "/Qas/SAP_ORION/Inbound" is current directory.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> CWD IRIIN04
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 250 CWD successful. "/Qas/SAP_ORION/Inbound/IRIIN04" is current directory.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> CWD TLOG.txt
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 550 CWD failed. "/Qas/SAP_ORION/Inbound/IRIIN04/TLOG.txt": directory not found.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> QUIT
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 221 Goodbye
    It should list  *TLOG.txt*  but instead it is trying to get into a directory named  *TLOG.txt*.  same for other interface.
    So me & my team is struggling for last couple of days to fix this issue.Please share your suggestion

    Hi Sisir
    The screen shot of your config doesn't seem to correspond to the FTP log. I say this because the * is dropped from file name pattern "*TLOG.txt" (comparing your config and the FTP log). Can you share an updated FTP log?
    Sisir Das wrote:
    "/Qas/SAP_ORION/Inbound/IRIIN04" is current directory.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> CWD TLOG.txt
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 550 CWD failed. "/Qas/SAP_ORION/Inbound/IRIIN04/TLOG.txt": directory not found.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> QUIT
    Also, like Rajesh suggested, have you tried to manually check permissions by logging in, traversing the directory, and getting the file?
    By the way, we always use backslash \ instead of forward slash in our configs. Not sure this would make any difference for you though. Also, I don't normally use a trailing \ at the end of the source directory path.

  • I am not able to mail the photos from iPhoto.  Its always saying that the email address it's not recognized.  Another situation is that when I try to add my me account in the preferences account, doesn't recognize my @me password. Tks for any help! :-)

    I am not able to mail the photos from iPhoto.  Its always saying that the email address it's not recognized.  Another situation is that when I try to add my me account in the preferences account, doesn't recognize my @me password. Tks for any help! :-)

    1. You did not get an error message telling you that your iPhoto library was getting full. You got a message telling you that your HD was getting full, right?
    OS X needs about 10 gigs of hard drive space for normal OS operations - things like virtual memory, temporary files and so on.
    Without this space your Mac will slow down as the OS hunts for space on the disk, files will be fragmented, also slowing things down, apps will crash and the risk of data corruption - that is damage to your files, photos, music - increases exponentially.
    Your first priority is to make more space on that HD. Nothing else can be done until you do.
    Purchase an external HD and move your Photos and Music to it. Both iPhoto and iTunes can run perfectly well with the Library on an external disk.
    Your Library has been damaged from being run on an overfull disk.
    How much free space on it now?

  • How to get an updatable ADODB Recordset from a Stored Procedure?

    In VB6 I have this code to get a disconnected ADODB Recordset from a Oracle 9i database (the Oracle Client is 10g):
    Dim conSQL As ADODB.Connection
    Dim comSQL As ADODB.Command
    Dim recSQL As ADODB.Recordset
    Set conSQL = New ADODB.Connection
    With conSQL
    .ConnectionString = "Provider=OraOLEDB.Oracle;Password=<pwd>;Persist Security Info=True;User ID=<uid>;Data Source=<dsn>"
    .CursorLocation = adUseClientBatch
    .Open
    End With
    Set comSQL = New ADODB.Command
    With comSQL
    .ActiveConnection = conSQL
    .CommandType = adCmdStoredProc
    .CommandText = "P_PARAM.GETALLPARAM"
    .Properties("PLSQLRSet").Value = True
    End With
    Set recSQL = New ADODB.Recordset
    With recSQL
    Set .Source = comSQL
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
    .LockType = adLockBatchOptimistic
    .Open
    .ActiveConnection = Nothing
    End With
    The PL/SQL Procedure is returning a REF CURSOR like this:
    PROCEDURE GetAllParam(op_PARAMRecCur IN OUT P_PARAM.PARAMRecCur)
    IS
    BEGIN
    OPEN op_PARAMRecCur FOR
    SELECT *
    FROM PARAM
    ORDER BY ANNPARAM DESC;
    END GetAllParam;
    When I try to update some values in the ADODB Recordset (still disconnected), I get the following error:
    Err.Description: Multiple-step operation generated errors. Check each status value.
    Err.Number: -2147217887 (80040E21)
    Err.Source: Microsoft Cursor Engine
    The following properties on the Command object doesn't change anything:
    .Properties("IRowsetChange") = True
    .Properties("Updatability") = 7
    How can I get an updatable ADODB Recordset from a Stored Procedure?

    4 years later...
    I was having then same problem.
    Finally, I've found how to "touch" the requierd bits.
    Obviously, it's hardcore, but since some stupid at microsoft cannot understand the use of a disconnected recordset in the real world, there is no other choice.
    Reference: http://download.microsoft.com/downlo...MS-ADTG%5D.pdf
    http://msdn.microsoft.com/en-us/library/cc221950.aspx
    http://www.xtremevbtalk.com/showthread.php?t=165799
    Solution (VB6):
    <pre>
    Dim Rst As Recordset
    Rst.Open "select 1 as C1, '5CHARS' as C5, sysdate as C6, NVL(null,15) as C7, null as C8 from DUAL", yourconnection, adOpenKeyset, adLockBatchOptimistic
    Set Rst.ActiveConnection = Nothing
    Dim S As New ADODB.Stream
    Rst.Save S, adPersistADTG
    Rst.Close
    Set Rst = Nothing
    With S
    'Debug.Print .Size
    Dim Bytes() As Byte
    Dim WordVal As Integer
    Dim LongVal As Long
    Bytes = .Read(2)
    If Bytes(0) <> 1 Then Err.Raise 5, , "ADTG byte 0, se esperaba: 1 (header)"
    .Position = 2 + Bytes(1)
    Bytes = .Read(3)
    If Bytes(0) <> 2 Then Err.Raise 5, , "ADTG byte 9, se esperaba: 2 (handler)"
    LongVal = Bytes(1) + Bytes(2) * 256 ' handler size
    .Position = .Position + LongVal
    Bytes = .Read(3)
    If Bytes(0) <> 3 Then Err.Raise 5, , "ADTG, se esperaba: 3 (result descriptor)"
    LongVal = Bytes(1) + Bytes(2) * 256 ' result descriptor size
    .Position = .Position + LongVal
    Bytes = .Read(3)
    If Bytes(0) <> 16 Then Err.Raise 5, , "ADTG, se esperaba: 16 (adtgRecordSetContext)"
    LongVal = Bytes(1) + Bytes(2) * 256 ' token size
    .Position = .Position + LongVal
    Bytes = .Read(3)
    If Bytes(0) <> 5 Then Err.Raise 5, , "ADTG, se esperaba: 5 (adtgTableDescriptor)"
    LongVal = Bytes(1) + Bytes(2) * 256 ' token size
    .Position = .Position + LongVal
    Bytes = .Read(1)
    If Bytes(0) <> 6 Then Err.Raise 5, , "ADTG, se esperaba: 6 (adtgTokenColumnDescriptor)"
    Do ' For each Field
    Bytes = .Read(2)
    LongVal = Bytes(0) + Bytes(1) * 256 ' token size
    Dim NextTokenPos As Long
    NextTokenPos = .Position + LongVal
    Dim PresenceMap As Long
    Bytes = .Read(3)
    PresenceMap = Val("&H" & Right$("0" & Hex$(Bytes(0)), 2) & Right$("0" & Hex$(Bytes(1)), 2) & Right$("0" & Hex$(Bytes(2)), 2))
    Bytes = .Read(2) 'ColumnOrdinal
    'WordVal = Val("&H" & Right$("0" & Hex$(Bytes(0)), 2) & Right$("0" & Hex$(bytes(1)), 2))
    'Aca pueden venir: friendly_columnname, basetable_ordinal,basetab_column_ordinal,basetab_colname
    If PresenceMap And &H800000 Then 'friendly_columnname
    Bytes = .Read(2) 'Size
    LongVal = Bytes(0) + Bytes(1) * 256 ' Size
    .Position = .Position + LongVal * 2 '*2 debido a UNICODE
    End If
    If PresenceMap And &H400000 Then 'basetable_ordinal
    .Position = .Position + 2 ' 2 bytes
    End If
    If PresenceMap And &H200000 Then 'basetab_column_ordinal
    .Position = .Position + 2 ' 2 bytes
    End If
    If PresenceMap And &H100000 Then 'basetab_colname
    Bytes = .Read(2) 'Size
    LongVal = Bytes(0) + Bytes(1) * 256 ' Size
    .Position = .Position + LongVal * 2 '*2 debido a UNICODE
    End If
    Bytes = .Read(2) 'adtgColumnDBType
    'WordVal = Val("&H" & Right$("0" & Hex$(Bytes(0)), 2) & Right$("0" & Hex$(bytes(1)), 2))
    Bytes = .Read(4) 'adtgColumnMaxLength
    'LongVal = Val("&H" & Right$("0" & Hex$(Bytes(3)), 2) & Right$("0" & Hex$(Bytes(2)), 2) & Right$("0" & Hex$(Bytes(1)), 2) & Right$("0" & Hex$(Bytes(0)), 2))
    Bytes = .Read(4) 'Precision
    'LongVal = Val("&H" & Right$("0" & Hex$(Bytes(3)), 2) & Right$("0" & Hex$(Bytes(2)), 2) & Right$("0" & Hex$(Bytes(1)), 2) & Right$("0" & Hex$(Bytes(0)), 2))
    Bytes = .Read(4) 'Scale
    'LongVal = Val("&H" & Right$("0" & Hex$(Bytes(3)), 2) & Right$("0" & Hex$(Bytes(2)), 2) & Right$("0" & Hex$(Bytes(1)), 2) & Right$("0" & Hex$(Bytes(0)), 2))
    Dim ColumnFlags() As Byte, NewFlag0 As Byte
    ColumnFlags = .Read(1) 'DBCOLUMNFLAGS, First Byte only (DBCOLUMNFLAGS=4 bytes total)
    NewFlag0 = ColumnFlags(0)
    If (NewFlag0 And &H4) = 0 Then 'DBCOLUMNFLAGS_WRITE (bit 2) esta OFF
    'Lo pongo en ON, ya que quiero escribir esta columna LOCALMENTE en el rst DESCONECTADO
    NewFlag0 = (NewFlag0 Or &H4)
    End If
    If (NewFlag0 And &H8) <> 0 Then 'DBCOLUMNFLAGS_WRITEUNKNOWN (bit 3) esta ON
    'Lo pongo en OFF, ya que no me importa si NO sabes si se puede updatear no, yo lo se, no te preocupes
    'ya que quiero escribir esta columna LOCALMENTE en el rst DESCONECTADO
    NewFlag0 = (NewFlag0 And Not &H8)
    End If
    If (NewFlag0 And &H20) <> 0 Then 'DBCOLUMNFLAGS_ISNULLABLE (bit 5) esta OFF
    'Lo pongo en ON, ya que siendo un RST DESCONECTADO, si le quiero poner NULL, le pongo y listo
    NewFlag0 = (NewFlag0 Or &H20)
    End If
    If NewFlag0 <> ColumnFlags(0) Then
    ColumnFlags(0) = NewFlag0
    .Position = .Position - 1
    .Write ColumnFlags
    End If
    .Position = NextTokenPos
    Bytes = .Read(1)
    Loop While Bytes(0) = 6
    'Reconstruyo el Rst desde el stream
    S.Position = 0
    Set Rst = New Recordset
    Rst.Open S
    End With
    'TEST IT
    On Error Resume Next
    Rst!C1 = 15
    Rst!C5 = "MUCHOS CHARS"
    Rst!C7 = 23423
    If Err.Number = 0 Then
    MsgBox "OK"
    Else
    MsgBox Err.Description
    End If
    </pre>

  • Updateable recordset from a stored procedure

    I would like to retrieve an updateable recordset from a stored procedure using the oracle 9.2.0.2.0
    oledb provider
    I am using the sample code/tables provided from Oracle.
    Does anyone have an example or has actually created an updatedable recordset from a stored procedure ?

    Assuming your stored procedure is returning a REF CURSOR, it cannot be done. Oracle's REF CURSORS are read only constructs.
    Justin

  • How to connect to UNIX OS from oracle stored procedure

    Hi,
    I need to connect to UNIX OS from oracle stored procedure.
    Curently working in Oracle9i.
    I tried in google but I could'nt get any.
    Can you send me pointers on how to do this.
    Thanks,
    Kavitha.

    Can use Java Stored Proc, or an External Proc.
    Java method:
    create or replace and compile Java Source named "OSCommand" as
    -- java:        OS COMMAND
    -- descr:       Executes an Operating System Command using the JAVA RTS
    -- IN parameter:        os command to execute (including fully qualified path names)
    -- OUT parameter:       returncode [\nstring]
    --                      where string a max of 32000 chars of the output of the command
    --                      (note that \n is used as separators in the string)
    --                      returncode=-1   Java RTS error occurred (e.g. command does not exist)
    --                      returncode=255  o/s command failed (e.g. invalid command params)
    import java.io.*;
    import java.lang.*;
    public class OSCommand{
            public static String Run(String Command){
                    Runtime rt = Runtime.getRuntime();
                    int     rc = -1;
                    try{
                            Process p = rt.exec( Command );
                            int bufSize = 32000;
                            int len = 0;
                            byte buffer[] = new byte[bufSize];
                            String s = null;
                            BufferedInputStream bis = new BufferedInputStream( p.getInputStream(), bufSize );
                            len = bis.read( buffer, 0, bufSize );
                            rc = p.waitFor();
                            if ( len != -1 ){
                                    s = new String( buffer, 0, len );
                                    return( s );
                            return( rc+"" );
                    catch (Exception e){
                            e.printStackTrace();
                            return(  "-1\ncommand[" + Command + "]\n" + e.getMessage() );
    show errors
    create or replace function osexec( cCommand IN string ) return varchar2 is
    -- function:    OS EXEC
    -- descr:       Executes an Operating System Command
    language        JAVA
    name            'OSCommand.Run(java.lang.String) return java.lang.String';
    show errors===
    This can then be used from PL/SQL and even SQL. e.g.
    SQL> select osexec( '/bin/date' ) from dual;
    OSEXEC('/BIN/DATE')
    Wed Nov  9 13:30:13 SAST 2005
    SQL>Note the Java permissions required - replace FOO with the name of applicable Oracle schema
    ==begin
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.io.FilePermission',
                    '<<ALL FILES>>',
                    'execute'
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'writeFileDescriptor',
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'readFileDescriptor',
            commit;
    end;
    /==
    Last thing... note that opens a potential giant size security hole into the Oracle Server Platform. So implement it properly using a proper Oracle security model.

  • Email from oracle stored procedure

    Can any one provide sample code for sending email from oracle stored procedure please.

    What do you mean "clicked on my link" and "login
    page"? It sounds like you're describing a web based
    interface, which would imply that you were using the
    HTTP protocol, not SMTP, and connecting on port 80
    (or 443 if you're using HTTPS). If you want to send
    an email from Oracle, you're going to need access to
    an SMTP server, not a HTTP server.
    JustinSorry. I was trying different things to test it. I put that link in an email just to test if it was valid. I am using the util_smtp package. Have you gotten this to work?

  • Passing data from Oracle stored procedures to Java

    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.

    user1754151 wrote:
    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.If logic is already written in DB, and the only concern is of passing the result to java service side, and also from point of maintenance problem and flexibility i would suggest to use the sys_refcursor.
    The reason if Down the line any thing changes then you only need to change the arguments of sys_refcursor in DB and as well as java side, and it is much easier and less efforts compare to using and changes required for Types and Objects on DB and java side.
    The design and best practise keeps changing based on our requirement and exisiting design. But by looking at your current senario and design, i personally suggest to go with sys_refcursor.

  • Arabic characters from Oracle Stored Procedure

    Hi,
    I am having a problem displaying arabic fields from Oracle Stored Procedure. When viewing the arabic field on the web page, i get the following:
    ÙƒØكد Øاكد غبد افلبٍ افاربش
    I have checked with our Oracle DBAs and we seem to be using the AR8ISO8859P6 (ISO-8859-6). I tried to set the return string encoding to UTF-16 and ISO-8859-6 but still no use.
    What should be done to display it?

    Bashar Abdullah wrote:
    Hi,
    I am having a problem displaying arabic fields from Oracle Stored Procedure. When viewing the arabic field on the web page, i get the following:
    I have checked with our Oracle DBAs and we seem to be using the AR8ISO8859P6 (ISO-8859-6). I tried to set the return string encoding to UTF-16 and ISO-8859-6 but still no use.
    What should be done to display it?The first place I'd ask is the Oracle JDBC forum:
    http://forums.oracle.com/forums/forum.jspa?forumID=99
    Joe

  • Calling OLE API from Oracle Stored Procedure

    An application that I need to intergate with exposes only the OLE API. How can I invoke these OLE APIs from Oracle stored procedure? Do I need any special/ additional Oracle components? Can you please help. Any links to examples would be very helpful. Thanks.

    If what you mean by Oracle stored procedures is pl/sql then yes.
    You can create a "wrapper" this way:
    CREATE OR REPLACE FUNCTION xmlXform
    in_mapUrl IN VARCHAR2,
    in_inputUrl IN VARCHAR2
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA NAME
    'com.yourcompany.xml2any.xform(java.lang.String,java.lang.String)
    RETURN java.lang.String';
    Then load the java as:
    loadjava -user youruser/youruserpasswd -resolve -verbose lib/xmlparserv2.jar classes/com/yourcompany/xform.class classes/com/yourcompany/xml2any.class
    The java, given the correct permissions, can do anything java can do including communicate with outside applications.
    Is this the "best" way... depends on what you are trying to accomplish.

  • Not able to edit the report from BO 5.1

    Hi,
    User has Business Objects 5.1 version on his machine  and he is able to login to Business Objects 5.1.2 and can also open the BO reports from the required path
    When he edit the report, the BO is gettng hung and following errors occured one by one when he clicks ok button
    error1: "you must close this universe(name of universe) before importing it"
    when he clicks OK button on this error, second error is received
    error2: "Some obsolete objects have been removed from the query. (QP0027)"
    When he clicks OK button on this error, third error is received
    error3:"A connection required to refresh this document is unavailable(DA0004)"
    I am not understanding why these three errors are receiving one by one.Please tell me how to resolve above errors and edit the report
    kind Regards,
    Srinivas

    Hi Denis,
    Normally,what we do is once we provide access to webi users group for each user from BO supervisor module, user(s) will able to refresh/edit the existing report from Full client BO.His colleagues have had no problem editing all his reports from their machines but he is not able to edit any report from his machine and BO is getting freeze.
    He also reinstalled BO and cleaned out everything on his Computer and re-built it but the issue is not yet resolved
    Can you please tell me how to resolve this issue
    Kind Regards,
    Srinivas

  • Not able to start the listener in oracle 10g  after the domain name changed

    Hi
    I had installed the oracle 10g on zLinux. It was working fine( was able to mount the database and start the listener). Now my server's domain name got changed. So i have added the new domain name in the tnsnames.ora and listeners.ora file . now i could able to mount the databases but am not able to start the listener . whille starting the listener , am getting the following error
    oracle@ptcr4d00:~> lsnrctl start
    LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 05-AUG-2009 10:31:05
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Starting /opt/oracle/10g/bin/tnslsnr: please wait...
    TNSLSNR for Linux: Version 10.2.0.2.0 - Production
    System parameter file is /opt/oracle/10g/network/admin/listener.ora
    Log messages written to /opt/oracle/10g/network/log/listener.log
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PTCR4D00)(PORT=1521)))
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    TNS-12547: TNS:lost contact
    TNS-12560: TNS:protocol adapter error
    TNS-00517: Lost contact
    Linux Error: 104: Connection reset by peer
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PTCR4D00)(PORT=1521)))
    TNS-12541: TNS:no listener
    TNS-12560: TNS:protocol adapter error
    TNS-00511: No listener
    Linux Error: 111: Connection refused
    I have posted the contents of the tnsnames.ora and listeners.ora
    TNSNAMES.ORA
    TC =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = PTCR4D00)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = TC)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    LISTENERS.ORA
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /opt/oracle/10g)
    (PROGRAM = extproc)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = PTCR4D00)(PORT = 1521))
    Could you please help me to resolve this issue ?
    Regards
    Mani

    Hi
    Please find the content of the /etc/hosts below
    # IP-Address Full-Qualified-Hostname Short-Hostname
    #127.0.0.1 localhost
    9.124.114.49 PTCR4D00
    # special IPv6 addresses
    ::1 localhost ipv6-localhost ipv6-loopback
    fe00::0 ipv6-localnet
    ff00::0 ipv6-mcastprefix
    ff02::1 ipv6-allnodes
    ff02::2 ipv6-allrouters
    ff02::3 ipv6-allhosts
    9.124.114.49 PTCR4D00 PTCR4D00
    Regards
    Mani

  • I have recently purchased a Panasonic TZ30 but I find that although still photos with upload into iphoto movies will not. I use imovie a great deal and find that I am not able to use the movies from my camera. Can anyone explain please ?

    Can anyone esplain why I cannot upload movies from my Panasonic TZ30 camera? I able to upload stills and I was able to upload movies from my previous Panasonic TZ5. Since I use iMovie a gret deal it is very disappointing not to be able to use the videos from my new camera.

    What format are you shooting? AVCHD? Not all versions of that are supported.
    A note on AVCHD: This format was developed for people who are shooting to edit the material afterwards. If you're shooting to edit, then iMovie or Final Cut are the correct home for this material. If you're not shooting to edit consider using one of the other video formats on your Camera.

  • Not able to retrieve order number from Oracle Apps

    Hi,
    We created a BPEL process to create order in Oracle Applications. We are calling a wrapper procedure which in turns calls pre-seeded API to creating an order using Oracle Applications Adapter. The Order is been creating in Oracle Applications but we are not able to get the Order number in return to the BPEL Process.
    Is there any configuration or setup to be done?. Can any one help out in this regard.
    Thanks in advance.
    Regards,
    Rami

    user11996936 wrote:
    Has anyone faced such an issue with Oracle Apps?Maybe. Maybe not. Ask to the proper forum. Here you are in Peoplesoft forum.
    Nicolas.

Maybe you are looking for