A little bit of help with Bind variables please

Hi,
I am having a bit of trouble with bind variables I have been looking at the Dev guide and the forum to try and achieve this and it is still not happening for me, could anybody please help or point me in the right direction:
I have created a simple PersonVO with the basic query:
Select distinct full_name from xxml_people where person_id = :1
In the PersonVOImpl.java I have added the method:
public void initQuery(String personId)
Number person = null;
try
person = new Number(personId);
catch
(Exception e){}
setWhereClauseParam(1,person);
executeQuery();
Then in the PersonAM I have added the method:
public void initPersonQuery(String personId)
getPersonVO1().initQuery(personId);
I then call this method in my processRequest section of my page controller:
PersonAMImpl am = (PersonAMImpl) pageContext.getRootApplicationModule();
String personId = "581";
am.initPersonQuery(personId);
When I try and run this I get the error:
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT distinct full_name from xxml_absence_calendar where person_id = :1
java.sql.SQLException: ORA-01006: bind variable does not exist
Am I binding the variables correctly? Or am I making some stupid mistake?
I am ultimately looking to create a messageChoice where the logged in user will see a list of all organisations underneath him and the one level above. I plan to do this by passing the User’s Organisation name into a VO query using the organisation as a Bind Variable. I think once I have worked out how to bind variables this should be straight forward.
Many Thanks

Even though the parameter binding values may be same, you should never use the positional param more than once. So always go for the format
select distinct full_name from xxml_people where supervisor_id = :1
UNION
select distinct full_name from xxml_people where person_id = :2
--Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Help with bind variables

    Hello I'm new to .net and I'm trying to work with bind variables
    I keep getting the ORA-01036: illegal variable name/number error.
    here's my code, can somebody help me out and show me what am I doing wrong?
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim drLocation As OracleDataReader = getSCLocation("SOMEBODY")
    End Sub
    Private Function getSCLocation(ByVal contactName As String) As OracleDataReader
    Dim drLocation As OracleDataReader
    Dim connString As String = ConfigurationManager.ConnectionStrings("scConnString").ConnectionString
    Dim conn As New OracleConnection(connString)
    conn.Open()
    Dim queryString As String = "select a.location, a.location_name from locationm1 a where a.primary_contact_dept in (select b.dept from contactsm1 b where b.contact_name = p_contactName)"
    Dim p_contactName As New OracleParameter
    p_contactName.OracleType = OracleType.VarChar
    p_contactName.Value = contactName
    Dim cmdLocation As New OracleCommand(queryString, conn)
    cmdLocation.Parameters.Add(p_contactName)
    drLocation = cmdLocation.ExecuteReader(CommandBehavior.CloseConnection)
    Return drLocation
    End Function
    Thanks
    Peter

    never mind i got it by playing around with it
    had to change the way to start the bind variable
    Dim p_contactName As New OracleParameter("p_contactName", OracleType.VarChar)
    p_contactName.Size = 140
    p_contactName.Value = contactName

  • Need a little bit of help with substring...

    Im very new at java programming, and need a bit of help with a problem:
    Here is what I have:
    System.out.print("Enter a string : ");
    Scanner scan = new Scanner (System.in);
    stringy = scan.nextLine();
    Now I want to split the string "stringy" like this: h:hi:hip:hipp:hippo
    I know this uses substring, but I can't figure out how to do it.
    Any help would be great, thanks!

    I know about the length method, what I dont knowis
    how to use the length and substring methodstogether
    to solve the problem i mentioned initially. There are three ingredients to perform this task:
    - String.length()
    - String.substring(int start, int end)
    - for-statement:
    http://java.sun.com/docs/books/tutorial/java/nutsandbo
    lts/for.html
    Pseudo code:IN <- input String from user
    LOOP FROM 0 -> IN.length()
    print IN.substring(?, ?)
    print ":"
    END LOOP
    Remember, Im very new. ;)Remember that by just handing you the solution, you
    will learn far less than finding things out by
    yourself.
    ; )Thanks a lot, i should be able to figure it out froom the pseudo code. :)

  • Little bit of help with the duplication process needed

    Hi
    I trying to duplicate a database from one server to a remote server. They are both running windows server 2003 (my first problem) , the primary server is running oracle 11gR1 and the (hopefully) receiving server is running 11gR2(is that going to be a problem?) and I'm a little stuck on some parts of the process.
    The book I'm using says to edit the listener.ora file to include a SID_DESC of the remote database. Here is my listener.ora file with the modifications
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = test.host.local)(PORT = 1521))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CGARDMSTR)
    (ORACLE_HOME = G:\app\administrator\product\11.1.0\db_1)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = CGARDMSTR)
    (ORACLE_HOME =G:\app\administrator\product\11.1.0\db_1)
    (SID_NAME = CGARDMSTR)
    *(SID_DESC* *=*
    *(GLOBAL_DBNAME* *=* cgard)
    *(ORACLE_HOME* *=F:\oracle\product\11.2.0\dbhome_1)*
    *(SID_NAME* *=* cgard)
    (bold is what i added)
    it then said to chnage my tnsnames.ora
    CGARD =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = test.host.local)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = cgard)
    CGARD5DE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = test.host.local)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = CGARD5DEV)
    CGARDMST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = test.host.local)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = CGARDMSTR)
    cgard =
    *(DESCRIPTION =*
    *(ADDRESS = (PROTOCOL = TCP)(HOST = live.host.local)(PORT = 1521))*
    *(CONNECT_DATA =*
    *(SERVER = DEDICATED)*
    *(SERVICE_NAME = cgard)*
    I changed the local domain to host for business reasons
    The next step was to create a initialization parameter file which I am guessing is a pfile and hopefully not a spfile. It then says to only enter one param db_name and the conversion params if the filesystem is diffrent. Problem is I don't know what to do with this file, if I am suppose to switch the second database to this file then surly I would need some more params? Anyway thats the first of many questions.
    When I try to run through the rman commands it describes it also trips up:
    RMAN> connect auxiliary sys/*********@live.host.local
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-04006: error from auxiliary database: ORA-12170: TNS:Connect timeout occurr
    ed
    The other database is up and connectable via sqldevloper so I'm guessing it was my configuration of listener and tnsnames
    Ok to reiterate my questions are:
    1) what needs to be in the pfile I create for the database thats going to receive the backup and what do I do with that file when I have made it?
    2) I am pretty sure my listener and tsunamis config is completely wrong so can I have some pointers on fixing that?
    3) Was the reason I could not connect to the receiving database my tns and listener config or is it something else?
    Quite a few other questions but untill I know some more about the above I doubt I will be able to ask properly.
    Also if this helps the book I am using is Expert Oracle Database 11g Administration and the page is 835(the method that begins on that page) and I am willing to write out the whole method if you need more details.
    Oh and if you havent figured it out I am very new to this so if some of this sounds very wrong or just stupid just say what I need to change and I will get right on it.
    Thanks
    Alex

    Ok so I have made some progress. Here is where I am currently at:
    RMAN> RUN
    2> {
    3> SET NEWNAME FOR DATAFILE 1 TO 'F:\oracle\oradata\cgard\file1.dbs';
    4> SET NEWNAME FOR DATAFILE 2 TO 'F:\oracle\oradata\cgard\file2.dbs';
    5> SET NEWNAME FOR DATAFILE 3 TO 'F:\oracle\oradata\cgard\file3.dbs';
    6> SET NEWNAME FOR DATAFILE 4 TO 'F:\oracle\oradata\cgard\file4.dbs';
    7> SET NEWNAME FOR DATAFILE 5 TO 'F:\oracle\oradata\cgard\file5.dbs';
    8> SET NEWNAME FOR TEMPFILE 1 TO 'F:\oracle\oradata\cgard\temp1.dbs';
    9> duplicate target database
    10> to cgard
    11> from active database
    12> pfile='F:\oracle\product\11.2.0\dbhome_1\database\initCGARD.ora';
    13> }
    executing command: SET NEWNAME
    starting full resync of recovery catalog
    full resync complete
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    Starting Duplicate Db at 19-NOV-10
    using channel ORA_AUX_DISK_1
    contents of Memory Script:
    set newname for datafile 1 to
    "F:\ORACLE\ORADATA\CGARD\FILE1.DBS";;
    set newname for datafile 2 to
    "F:\ORACLE\ORADATA\CGARD\FILE2.DBS";;
    set newname for datafile 3 to
    "F:\ORACLE\ORADATA\CGARD\FILE3.DBS";;
    set newname for datafile 4 to
    "F:\ORACLE\ORADATA\CGARD\FILE4.DBS";;
    set newname for datafile 5 to
    "F:\ORACLE\ORADATA\CGARD\FILE5.DBS";;
    backup as copy reuse
    datafile 1 auxiliary format
    "F:\ORACLE\ORADATA\CGARD\FILE1.DBS"; datafile
    2 auxiliary format
    "F:\ORACLE\ORADATA\CGARD\FILE2.DBS"; datafile
    3 auxiliary format
    "F:\ORACLE\ORADATA\CGARD\FILE3.DBS"; datafile
    4 auxiliary format
    "F:\ORACLE\ORADATA\CGARD\FILE4.DBS"; datafile
    5 auxiliary format
    "F:\ORACLE\ORADATA\CGARD\FILE5.DBS"; ;
    sql 'alter system archive log current';
    executing Memory Script
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    Starting backup at 19-NOV-10
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=143 device type=DISK
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00001 name=G:\APP\ADMINISTRATOR\ORADATA\CGARDMSTR\SYS
    TEM01.DBF
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/19/2010 16:23:
    52
    ORA-17629: Cannot connect to the remote database server
    ORA-17627: ORA-01017: invalid username/password; logon denied
    ORA-17629: Cannot connect to the remote database server
    continuing other job steps, job failed will not be re-run
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00004 name=G:\APP\ADMINISTRATOR\ORADATA\CGARDMSTR\USE
    RS01.DBF
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/19/2010 16:24:
    24
    ORA-17629: Cannot connect to the remote database server
    ORA-17627: ORA-01017: invalid username/password; logon denied
    ORA-17629: Cannot connect to the remote database server
    continuing other job steps, job failed will not be re-run
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00002 name=G:\APP\ADMINISTRATOR\ORADATA\CGARDMSTR\SYS
    AUX01.DBF
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/19/2010 16:24:
    43
    ORA-17629: Cannot connect to the remote database server
    ORA-17627: ORA-01017: invalid username/password; logon denied
    ORA-17629: Cannot connect to the remote database server
    continuing other job steps, job failed will not be re-run
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00003 name=G:\APP\ADMINISTRATOR\ORADATA\CGARDMSTR\UND
    OTBS01.DBF
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/19/2010 16:25:
    17
    ORA-17629: Cannot connect to the remote database server
    ORA-17627: ORA-01017: invalid username/password; logon denied
    ORA-17629: Cannot connect to the remote database server
    continuing other job steps, job failed will not be re-run
    channel ORA_DISK_1: starting datafile copy
    input datafile file number=00005 name=G:\APP\ADMINISTRATOR\ORADATA\CGARDMSTR\RMA
    N01.DBF
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 11/19/2010 16:25:55
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/19/2010 16:25:
    55
    ORA-17629: Cannot connect to the remote database server
    ORA-17627: ORA-01017: invalid username/password; logon denied
    ORA-17629: Cannot connect to the remote database server
    RMAN>
    I did issue the commands:
    C:\Documents and Settings\Administrator>rman target /
    Recovery Manager: Release 11.1.0.6.0 - Production on Fri Nov 19 13:55:40 2010
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    connected to target database: CGARDMST (DBID=3160500813)
    RMAN> connect catalog rman/rman
    connected to recovery catalog database
    RMAN> connect auxiliary sys/**********@cgard
    connected to auxiliary database: CGARD (not mounted)
    So I am not quite sure what it wants. I read somewhere about a password file but I don't understand how it will help, also most things I have looked at wernt clear on how to do it. I took a stab anyway:
    G:\app\administrator\product\11.1.0\db_1\BIN>orapwd file=orapwcgard password=*********** entries=20 ignorecase=n
    Was run on the original database host.
    File was then copied to "F:\oracle\product\11.2.0\dbhome_1\database" on the receiving database's host it was then renamed to PWDcgard.ora as there was file there already with that name.
    It did not help(same error).
    The book I am using mentions the 'PASSWORD FILE' param to be used with the duplicate command but I cant find a example on how to use it so any help with that would be great.
    Thanks for the effort so far guys its really appreciated.

  • [Oracle 8i] Need help with bind variable in add_months function

    I'm trying to put a variable within my add_months function:
    AND     t1.edatetime >= add_months(sysdate,:v1)
    AND     t1.edatetime <= add_months(sysdate,:v2)I have tried defining the variable both as 'integer' type and 'numeric' type, but in both cases, my query returns no results. If I hard code the values, it works just fine.
    Any suggestions?

    Hi,
    Sorry, I can't reproduce the problem.
    What do you mean by "I have tried defining the variable both as 'integer' type and 'numeric' type"?
    Like Max said, you should post a complete script that gets the incorrect results.
    Include your CREATE TABLE and INSERT statements, or use tables that are commonly available.
    For example:
    VARIABLE      v1     NUMBER
    VARIABLE      v2     NUMBER
    EXEC  :v1 := -28 * 12;
    EXEC  :v2 := -27 * 12;
    PROMPT       ===== Checking values of bind variables  =====
    SELECT       :v1
    ,       :v2
    FROM       dual;
    PROMPT       =====  Main query (expecting 1 row of output) =====
    SELECT       ename
    ,       hiredate
    FROM       scott.emp
    WHERE       hiredate     >= ADD_MONTHS (SYSDATE, :v1)
    AND       hiredate     <= ADD_MONTHS (SYSDATE, :v2)
    ;Output:
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    ===== Checking values of bind variables  =====
           :V1        :V2
          -336       -324
    =====  Main query (expecting 1 row of output) =====
    ENAME      HIREDATE
    MILLER     23-Jan-1982

  • Help with bind variable

    I am very new to this site so I hope I get the format right...
    I am using Oracle Application Express Edition and trying to answer a question for my class, but I keep getting the same error every time. I've looked it up and it's apparently a storage error, but I don't understand how it can be a storage error if I'm not able to store it in the first place. So confused! Please help!
    Here's my code and the error I keep getting:
    DECLARE
    VARIABLE b_basic number
    VARIABLE b_pf number
    today DATE:=SYSDATE;
    tomorrow today%TYPE;
    BEGIN
    b_basic:=45;
    b_pf:=12;
    tomorrow:=today +1;
    DBMS_OUTPUT.PUT_LINE(' Hello World ');
    DBMS_OUTPUT.PUT_LINE('TODAY IS : '|| today);
    DBMS_OUTPUT.PUT_LINE('TOMORROW IS : ' || tomorrow);
    END;
    ORA-06550: line 2, column 23: PLS-00103: Encountered the symbol "NUMBER" when expecting one of the following: := . ( @ % ; not null range default character
    --------------------------------------------------------------------------------

    Don't mix SQL*Plus and PL/SQL syntax. In PL/SQL there is no VARIABLE keyword, just remove it.
    See http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/fundamentals.htm#LNPLS208.
    With this:
    set echo on
    set serveroutput on
    DECLARE
    b_basic number;
    b_pf number;
    today DATE:=SYSDATE;
    tomorrow today%TYPE;
    BEGIN
    b_basic:=45;
    b_pf:=12;
    tomorrow:=today +1;
    DBMS_OUTPUT.PUT_LINE(' Hello World ');
    DBMS_OUTPUT.PUT_LINE('TODAY IS : '|| today);
    DBMS_OUTPUT.PUT_LINE('TOMORROW IS : ' || tomorrow);
    END;
    /you get with SQL*Plus command line:
    SQL> set serveroutput on
    SQL> --
    SQL> DECLARE
      2  b_basic number;
      3  b_pf number;
      4  today DATE:=SYSDATE;
      5  tomorrow today%TYPE;
      6  BEGIN
      7  b_basic:=45;
      8  b_pf:=12;
      9  tomorrow:=today +1;
    10  DBMS_OUTPUT.PUT_LINE(' Hello World ');
    11  DBMS_OUTPUT.PUT_LINE('TODAY IS : '|| today);
    12  DBMS_OUTPUT.PUT_LINE('TOMORROW IS : ' || tomorrow);
    13  END;
    14  /
    Hello World
    TODAY IS : 05-FEB-13
    TOMORROW IS : 06-FEB-13
    PL/SQL procedure successfully completed.Try to post APEX specific questions in APEX dedicated forum Oracle Application Express (APEX)
    Edited by: P. Forstmann on 5 févr. 2013 13:38
    Edited by: P. Forstmann on 5 févr. 2013 13:40

  • Little bit of help[ with a button.

    Good day all!
    I need help making a button. This is what I want to happen.
    I have a bunch of text, One of the words "merino" is bule as
    to say there is a link hear! And I want an image of the "merino" to
    come up, like a "ALT" box. Or have an image in the "ALT" box?
    I know how to do this in "Flash" i.e just drop in the image
    on the over state of the button event. Easy as pie! This is why I
    cant get to grips with Dreamweaver! I hate it!
    But I am willing to learn and maybe in time love???
    Thanks all!

    "satrop" <[email protected]> wrote in
    message
    news:f0o4t7$954$[email protected]..
    > Good day all!
    >
    > I need help making a button. This is what I want to
    happen.
    >
    > I have a bunch of text, One of the words "merino" is
    bule as to say there
    > is a
    > link hear! And I want an image of the "merino" to come
    up, like a "ALT"
    > box.
    >
    > I know how to do this in "Flash" i.e just drop in the
    image on the over
    > state
    > of the button event. Easy as pie! This is why I cant get
    to grips with
    > Dreamweaver! I hate it!
    >
    > But I am willing to learn and maybe in time love???
    HTML is a lot different from Flash! :-)
    I believe you could do this using DW's Show-Hide layer
    behavior - have
    mousing over the link trigger a layer with the image to
    appear. Someone else
    may have a better idea.
    Just FYI, having to mouse over a link in order to get more
    information about
    it isn't usually appreciated by users. You *might* want to
    re-think this
    plan..
    Patty Ayers | Adobe Community Expert
    www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet

  • A little bit of help with arrays

    Hi guyz
    I have a problem regarding reading and processing element of an array. I have a "Reference Base Generator" and for example I generate a sine wave. Then I use "Get waveform components" to get the data from the graphic, after this i have a 1-D array of data  (right?) at the output of the "Get waveform component' bloc. I need to read every element, process it and then send it as a value further to a function input. So, how can i get every element of that array and send it further ?
    I hope I was clear with my problem.
    It would be great if you could provide me with some help. 
    Thanks alot,
    Andrei_L. 
    Solved!
    Go to Solution.

    And just for completeness sake:
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Example_VI_BD.png ‏24 KB

  • Help with session variable please - CS5.5 PHP

    Hi all,
    I am needing a little assistance with using a session variable and hope that someone may point me in the right direction.
    I have created a PHP page that uses the Dreamweaver 'User Authentication' feature, and the basics of this works fine, directing a user to the correct pages depending on whether they are or are not a valid user. I would like however to personalise the 'valid user' page with the persons Username as entered in the User Authentication table....a seemingly simple task using a session variable, but one that I just don't seem to be able to get working!
    The code generated for the UA on page 1 is as follows:
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
      session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
      $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['txtfirst_name'])) {
      $loginUsername=$_POST['txtfirst_name'];
      $password=$_POST['txtsurname'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "member_update.php";
      $MM_redirectLoginFailed = "login.php";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_panto, $panto);
      $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND surname=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $panto) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
        if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
        //declare two session variables and assign them
       $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;         
        if (isset($_SESSION['PrevUrl']) && false) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];   
        header("Location: " . $MM_redirectLoginSuccess );
      else {
        header("Location: ". $MM_redirectLoginFailed );
    ?>
    Firstly, the text highlighted in red above appears to be setting the session variable that I require. Is This correct?
    If so, what is the code that I need to place in page 2 to use that session variable? or
    Do I need to do something else on page 1 to properly assign the session variable?
    Would really appreciate your expertise
    Mark

    It looks as though you've set the columns incorrectly in the User Authentication server behavior. This is the SQL query that checks the user's credentials:
      $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND surname=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
    You're looking for firstname and surname, whereas you should be looking for the user's login name and password.
    $_SESSION['MM_Username'] is a session variable that stores the user's login name. To use it in a subsequent page, all that's needed is for the page to begin with session_start(). You can then echo the value to display it.
    If you want to display the person's real name, you need to create a recordset in the second page using $_SESSION['MM_Username'] to find the firstname and surname. Alternatively, you can edit the existing code like this (I've copied only part of it):
      $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND password=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $panto) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
        $row = mysql_fetch_assoc($LoginRS);
         $_SESSION['full_name'] = $row['firstname'] . ' ' . $row['surname'];
        if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
        //declare two session variables and assign them
       $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;
    You can then use $_SESSION['full_name'] in a subsequent page that begins with session_start().

  • Help with CLASSPATH variable please

    Hi everyone!!
    Please, help to set up my classpath variable. I know I know I have guidelines in API but I don't achieve it, I'm so clumsy.
    I've formated my hard disk and installed everything again, but the classpath is wrong because I can't compile my java files.
    I've tried with this:
    C:\Program Files\Java\jdk1.5.0_06\scr.zip;C:\Program Files\Java\jdk1.5.0_06\javac.exe;C:\Program Files\Java\jdk1.5.0_06\java.exe
    I've also tried with the same lines but unnaming files (finishing with '\')
    What am I doing wrong?
    Thank you very much for your attention and help.
    Merry Christmas and Happy New Year!!
    And I hope the Three Wise Men bring you everything!!

    Please post your exact problem and the exact error message. I think you are having a problem compiling, but I am not sure. What is not working? What is the error?
    You posted a path, but if that is your Classpath, you should not have javac or java in the Classpath.

  • Need help in Bind variable in AF Query LOV

    Hi,
    i have one problem with bind variable, if i use bind variable in the LOV VO Query then my result is not coming, if there is not bind variable it's working fine and if i use the bind variable in the LOV search option then it's working fine but if i hide the bind variable and set the value in AM prepareSesstion method the LOV is not returning any value. I try to return the values also all values are also coming but those values are not setting to AF Query Attribute.
    Query is:
    select substr(d.description,0,40) description
    from cm_system_users a,
    cm_user_responsibilities b,
    cm_responsibility_processes c,
    cm_processes d
    where a.nt_login =:B_NT_LOGIN
    and a.user_id = b.user_id
    and trunc(sysdate) between b.eff_date and nvl(b.exp_date,sysdate + 1)
    and b.RESPONSIBILITY_ID = c.RESPONSIBILITY_ID
    and c.process_type = d.process_type
    and d.enabled_flag = 'Y' order by d.arguments_flag
    AM Method:
    CmProcessViewImpl vo = getCmProcessView();
    String nt_login = getUserPrincipalName();
    vo.setNamedWhereClauseParam("B_NT_LOGIN", nt_login.toUpperCase());
    vo.executeQuery();
    Can any one help me in this. it's urgent for me.

    This is a little underdescribed. IIUC, the view object in question is being used as a target for a view accessor, correct? (Otherwise you'll have to be more explicit about what you mean by "Query LOV".
    If I'm right, there are two possibilities:
    1) You are using a VO instance in a shared application module instance. If so, make sure your code is in the prepareSession() for that application module class if it's session dependent (as it seems to be below), you need to make sure the application module instance is shared at session scope.
    2) You've based the view accessor directly on the VO definition. This basically creates an anonymous VO instance; I don't think there's any way to use prepareSession() to set a bind variable on such an instance (which won't be created until the accessor is first used). You might be able to get by with putting similar code into the view object class' create() method, but I haven't tested this.
    If your code is in your primary application module class (as opposed to the class for a shared AM instance), the problem here is that getCmProcessView() returns the VO instance from that application module instance's design-time data model, which is never used by view accessors.
    By the way, why do you need to do this in prepareSession() instead of at the view accessor level? I believe you can get the logged in user name (for the view accessor) in with the groovy expression
    viewObject.DBTransaction.session.userPrincipalName
    or possibly just
    DBTransaction.session.userPrincipalName
    (despite this involving DBTransaction, it returns the web app user name, not the DB username).
    That's a 100% declarative solution, if you don't count the Groovy expression as non-declarative.
    If you're afraid of a user executing the LOV (somehow) before the bind variable value gets set, just ensure that the bind variable is marked "required".

  • SLOW report performance with bind variable

    Environment: 11.1.0.7.2, Apex 4.01.
    I've got a simplified report page where the report runs slowly compared to running the same query in sqldeveloper. The report region is based on a pl/sql function returning a query. If I use a bind variable in the query inside apex it takes 13 seconds to run, and if I hard code a string it takes only a few hundredths of a second. The query returns one row from a table which has 1.6 million rows. Statistics are up-to-date and the columns in the joins and where clause are indexed.
    I've run traces using p_trace=YES from Apex for both the bind variable and hard coded strings. They are below.
    The sqldeveloper explain plan is identical to the bind variable plan from the trace, yet the query runs in 0.0x seconds in sqldeveloper.
    What is it about bind variable syntax in Apex that is causing the bad execution plan? Apex Bug? 11g bug? Ideas?
    tkprof output from Apex trace with bind variable is below...
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM(:P71_SEARCH_SOURCE1)))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.01          0          1         27           0
    Fetch        2     13.15      13.22      67694      72865          0           1
    total        4     13.15      13.23      67694      72866         27           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=72869 pr=67694 pw=0 time=0 us cost=29615 size=14255040 card=178188)
          1   FILTER  (cr=72869 pr=67694 pw=0 time=0 us)
          1    HASH JOIN RIGHT SEMI (cr=72865 pr=67694 pw=0 time=0 us cost=26308 size=14255040 card=178188)
          1     INDEX FAST FULL SCAN IDX$$_0A300001 (cr=18545 pr=13379 pw=0 time=0 us cost=4993 size=2937776 card=183611)(object id 68485)
    1696485     TABLE ACCESS FULL PERSONS (cr=54320 pr=54315 pw=0 time=21965 us cost=14958 size=108575040 card=1696485)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     HASH JOIN (RIGHT SEMI)
          1      INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                     'IDX$$_0A300001' (INDEX)
    1696485      TABLE ACCESS   MODE: ANALYZED (FULL) OF 'PERSONS' (TABLE)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file scattered read                       1276        0.00          0.16
      db file sequential read                       812        0.00          0.02
      direct path read                             1552        0.00          0.61
    ********************************************************************************Here's the tkprof output with a hard coded string:
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM('0b')))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.02       0.04          0          0          0           0
    Execute      1      0.00       0.00          0          0         13           0
    Fetch        2      0.00       0.00          0          8          0           1
    total        4      0.02       0.04          0          8         13           1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=10 pr=0 pw=0 time=0 us cost=9 size=80 card=1)
          1   FILTER  (cr=10 pr=0 pw=0 time=0 us)
          1    NESTED LOOPS  (cr=8 pr=0 pw=0 time=0 us)
          1     NESTED LOOPS  (cr=7 pr=0 pw=0 time=0 us cost=8 size=80 card=1)
          1      SORT UNIQUE (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1       TABLE ACCESS BY INDEX ROWID PERSON_SYSTEMS (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1        INDEX RANGE SCAN IDX_PERSON_SYSTEMS_SOURCE_KEY (cr=3 pr=0 pw=0 time=0 us cost=3 size=0 card=1)(object id 68561)
          1      INDEX UNIQUE SCAN PK_PERSONS (cr=3 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 68506)
          1     TABLE ACCESS BY INDEX ROWID PERSONS (cr=1 pr=0 pw=0 time=0 us cost=2 size=64 card=1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     NESTED LOOPS
          1      NESTED LOOPS
          1       SORT (UNIQUE)
          1        TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                       'PERSON_SYSTEMS' (TABLE)
          1         INDEX   MODE: ANALYZED (RANGE SCAN) OF
                        'IDX_PERSON_SYSTEMS_SOURCE_KEY' (INDEX)
          1       INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'PK_PERSONS'
                      (INDEX (UNIQUE))
          1      TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                     'PERSONS' (TABLE)

    Patrick, interesting insight. Thank you.
    The optimizer must be peeking at my bind variables with it's eyes closed. I'm the only one testing and I've never passed %anything as a bind value. :)
    Here's what I've learned since my last post:
    I don't think that sqldeveloper is actually using the explain plan it says it is. When I run explain plan in sqldeveloper (with a bind variable) it shows me the exact same plan as Apex with a bind variable. However, when I run autotrace in sqldeveloper, it takes a path that matches the hard coded values, and returns results in half a second. That autotrace run is consistent with actually running the query outside of autotrace. So, I think either sqldeveloper isn't really using bind variables, OR it is using them in some other way that Apex does not, or maybe optimizer peeking works in sqldeveloper?
    Using optimizer hints to tweak the plan helps. I've tried both /*+ FIRST_ROWS */ and /*+ index(ps pk_persons) */ and both drop the query to about a second. However, I'm loath to use hints because of the very dynamic nature of the query (and Tom Kyte doesn't like them either). The hints may end up hurting other variations on the query.
    I also tested the query by wrapping it in a select count(1) from ([long query]) and testing the performance in sqldeveloper and in Apex. The performance in that case is identical with both bind variables and hard coded variables for both Apex and SqlDeveloper. That to me was very interesting and I went so far as to set up two bind variable report regions on the same page. One region wrapped the long query with select count(1) from (...) and the other didn't. The wrapped query ran in 0.01 seconds, the unwrapped took 15ish seconds with no other optimizations. Very strange.
    To get performance up to acceptable levels I have changed my function returning query to:
    1) Set the equality operator to "=" for values without wildcards and "like" for user input with wildcards. This makes a HUGE difference IF no wildcard is used.
    2) Insert a /*+ FIRST_ROWS */ hint when users chose the column that requires the sub-query. This obviously changes the optimizer's plan and improves query speed from 15 seconds to 1.5 seconds even with wildcards.
    I will NOT be hard coding any user supplied values in the query string. As you can probably tell by the query, this is an application where sql injection would be very bad.
    Jeff, regarding your question about "like '%' || :P71_SEARCH_SOURCE1 || '%'". I've found that putting wildcards around values, particularly at the beginning will negate any indexing on the column in question and slows performance even more.
    I'm still left wondering if there isn't something in Apex that is breaking the optimizer "peeking" that Patrick describes. Perhaps something in the way it switches contexts from apex_public_user to the workspace schema?

  • How to querie with bind variable in findMode?

    Hallo,
    is it possible to use a querie with bind variable in findMode? And when how is it possible to initialize the bind variable?
    Any help is appreciated.

    Hi,
    bind variables can be linked from teh ADF binding to e.g. a managed bean, the sessionScope or other binding attributes via EL. So when you go into findMode and execute the query, the EL will grab the bindVariable values automatically.
    Frank

  • BC4J bug with "bind variables" JBO-27122 ORA-01008

    I think we are found a BUG using BC4J with bind variables in a view object.
    If the bind variable appear in the WHERE condition two or more times at
    the beginning of the query the above error occur.
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement:
    SELECT Emp.EMPNO,Emp.ENAME,Emp.JOB,Emp.MGR,Emp.HIREDATE,Emp.SAL,Emp.COMM, Emp.DEPTNO
    FROM SCOTT.EMP Emp
    WHERE :1 <=10000 and :1 <= sal and :2=20
    java.sql.SQLException: ORA-01008: not all variables bound
    Otherwise if bind variable apper two or more times, but not together
    like this sample:
    WHERE :1 <=10000 and :2=20 and :1 <= sal
    the error not occur.
    We prove this with:
    JDeveloper 9.0.5.2 (build 1618)Business Components Version 9.0.5.16.0
    JDeveloper 9.0.5.0 (build 1375)Business Components Version 9.0.5.13.52
    I looking for a patch! or acceptable workaround.
    Tx for your help!
    diego.
    /* the cliente app */
    ApplicationModule am = Configuration.createRootApplicationModule("business_tier.AppModule","AppModuleLocal");
    ViewObject vo = am.findViewObject("EmpView");
    vo.setWhereClauseParam(0,"100");
    vo.setWhereClauseParam(1,"20");
    Row emp = vo.first();

    This is a known bug (1326006). The workaround is to use:
    vo.setWhereClauseParam(0,"100");
    vo.setWhereClauseParam(1,"20");
    vo.setWhereClauseParam(2,"20");
    Hope this helps,
    Lynn
    Java Tools Team

  • HT4208 I just need a little bit of help. I visited the american ap store looking for the new scrabble game which is not available in the australian ap store. Can't get it anyway as I don't have an account there. I am trying to get back to the australian a

    I just need a little bit of help. I visited the american ap store, using my i phone, to check out something. I dont have an account with them so I couldn't get what I wanted anyway.Now, I need to get back to the australian store and I don't know how to do that. Please help!

    Go to app store- scroll down to bottom- click on apple id- change country

Maybe you are looking for