Dynamics, where the form of Clause - Oracle 10g

Hi all

The scenario is we provide an interface (via form 10g) to execute different queries. These requests have set the columns and tables (for example, we have same SELECT and FROM clauses for each request). However, WHERE clause is unique for each request. So, I'm writing a dynamic cursor, but DYNAMIC CURSORS are not clear for me. I post my code for taking advice from experts in the forum.


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Load_Rows EXEC_SQL. CursType;

New_Query varchar2 (5000) = ' SELECT IRR_TAMPERED_OK | «, » || IRR_DATE_DISPATCHED | «, » || IRR_DISPATCHED_NO | «, » || IRR_REG_ID | «, » || IRR_CONS_NO | «, » || CON_NAM | «, » || CON_ADR | «, » || IRR_SR | «, » ||

EMC_EVC_NO | «, » || IRR_TNO | «, » || IRR_MTR_TYPE | «, » || IRR_MTR_DIC | «, » || MTR_RED_COR | «, » || MTR_RED_UNCOR | «, » || MTR_RED | «, » || IRR_FP_SIGN | «, » || IRR_FP_OPEN | «, » || IRR_FP_SIGN_CHK | «, » || IRR_FP_CHK | «, » || IRR_20PSIG_SIGN | «, » || IRR_20_PSIG_VALUE | «, » || IRR_40_PSIG_SIGN | «, » || IRR_40_PSIG_VALUE | «, » || IRR_60_PSIG_SIGN | «, » || IRR_60_PSIG_VALUE | «, » || IRR_80_PSIG_SIGN | «, » || IRR_80_PSIG_VALUE | «, » || DTE_REM | «, » || DTE_REC | «, » || IRR_CALL_REMARKS | «, » || IRR_SEAL_COND | «, » || IRR_G_OBSER | «, » || Data IRR_REMARKS

Of

inproving_result_remarks, MTR_RET_CRD' | : WHERE_CLAUSE;

Start

Load_Rows: = Exec_SQL. Open_cursor;

EXEC_SQL. PARSE (Load_Rows, New_Query);

EXEC_SQL. DEFINE_COLUMN (Load_Rows, 1, v_colchar1, 30);

EXEC_SQL. DEFINE_COLUMN (Load_Rows, 2, v_colchar2, 15);

EXEC_SQL. DEFINE_COLUMN (Load_Rows, 3, v_colchar3, 30);

v_exec: = EXEC_SQL. Execute (Load_Rows);

WHILE EXEC_SQL. FETCH_ROWS (Load_Rows) > 0 LOOP

EXEC_SQL. COLUMN_VALUE(Load_Rows,1,v_colchar1);

EXEC_SQL. COLUMN_VALUE(Load_Rows,2,v_colchar2);

EXEC_SQL. COLUMN_VALUE(Load_Rows,3,v_colchar3);

END LOOP;

EXEC_SQL. CLOSE_CURSOR (Load_Rows);

end;


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


I have to integrate above slider DYNAMICS written in the code below that was written using a simple slider:


BEGIN

-Path to the file

user_nam: = WebUtil_ClientInfo.Get_User_Name ();

path_part: = to_char (sysdate, 'DD-MM-YYYY (MI-HH-SS)');

lv_File_Name: ='C:\Users\'|| user_nam | "\CMS_MIR_'|| path_part |'. CSV';

-Open the file in write mode

lv_File: = client_text_io. FOpen (lv_File_Name, 'W');

-Write the header columns

client_text_io. Put_Line(lv_File,'IRR_TAMPERED_OK, IRR_DATE_DISPATCHED,IRR_DISPATCHED_NO,IRR_REG_ID,IRR_CONS_NO,CON_NAM,CON_ADR,IRR_SR,EMC_EVC_NO,IRR_TNO,IRR_MTR_TYPE,IRR_MTR_DIC,MTR_RED_COR,MTR_RED_UNCOR,MTR_RED,IRR_FP_SIGN,IRR_FP_OPEN,IRR_FP_SIGN_CHK,IRR_FP_CHK,IRR_20PSIG_SIGN,IRR_20_PSIG_VALUE IRR_40_PSIG_SIGN (, IRR_40_PSIG_VALUE, IRR_60_PSIG_SIGN, IRR_60_PSIG_VALUE, IRR_80_PSIG_SIGN, IRR_80_PSIG_VALUE, DTE_REM, DTE_REC, IRR_CALL_REMARKS, IRR_SEAL_COND, IRR_G_OBSER, IRR_REMARKS');

-- Write lines in the file

Row_Count: = 0;

FOR i IN Load_Rows LOOP

-COUNT: = Load_Rows % ROWCOUNT; -counter

Row_Count: = Row_Count + 1;

client_text_io. Put_line (lv_File, i.DATA);

IF Row_Count = 5000 THEN

Synchronize;

Row_Count: = 0;

END IF;

END LOOP;

-Classify

client_text_io. FClose (lv_File);

Message ("meter inspection report was generated: C:\Users\'||") user_nam | "\CMS_MIR_'|| path_part);

Message ("meter inspection report was generated: C:\Users\'||") user_nam | "\CMS_MIR_'|| path_part);

END;

Just so that I understand what you're trying, you are not display the results in your form, you simply run a dynamic query that you export the results to a file.  Is this correct?

So, what happens when you run your code?  Are you an error (If Yes, what is the full error)?

One suggestion that I have after reviewing your code example is that you don't have a space after your FROM clause before you concatenate your WHERE Clause in your sql string variable.

Your example Code:

...
FROM
inproving_result_remarks,MTR_RET_CRD'||:WHERE_CLAUSE;

There should be a space after MTR_RET_CRD.  For example:

...
FROM
inproving_result_remarks,MTR_RET_CRD '||:WHERE_CLAUSE;

Without the space your SQL will not scan properly.

Another suggestion that I have is that you move your code from collection to a stored procedure (procedure or function) in your database of data and your stored procedure returns a collection.  This will eliminate the constant travel to the database for each line of the recording because your stored procedure will return the record complete game.  In addition, your stored procedure allows you to use dynamic SQL Native (Execute Immediate) will allow instead of using dynamic SQL from forms (EXEC_SQL) package. Native dynamic SQL is much more efficient and a lot less code.  In order to use native dynamic SQL, you must have on the Oracle Database 9i or higher.

Craig...

Tags: Oracle Development

Similar Questions

  • connect the form builder to oracle 10g express?

    Hello

    How to connect the 10 form builder to oracle 10g express?

    Developer suite Home use Net Configuration Assistant to create an alias TNS (tnsnames.ora entry).

  • How to find the site to download oracle 10g

    Hello

    I need to find the site to download oracle 10g. Please, help me.

    Respect of
    Natalia

    10g is no longer available for download - you need to open an SR with Support and they will provide a download link, assuming you paid for extended support.

    PL see the previous discussions on this topic

    year https://forums.Oracle.com/forums/Search.jspa?threadID=&q=10g+and+Download&objid=C18&DateRange=This & userID = & numResults = 15

    HTH
    Srini

  • DBMS_XMLGEN. GETXML confusing WHERE the condition of clause?

    I can't quite wrap my head around that, but I found the following query

    Select * from user_views
    where dbms_xmlgen.getxml ("select text from user_views where view_name =" "|") view_name | ') like '% view_table_name % '.

    I am totally confuse everything, that's what makes the WHERE condition in the query?

    When I run the game "highlight text" it returns nothing

    If anyone knows why the WHERE clause is necessary?

    Thank you

    rodneyc8063 wrote:
    I don't understand why there are extra, extra quotes | and the "solomon_is_cool".

    Additional citations have nothing to do with dbms_xmlgen. In string literals Oracle must be in quotes by acronym. So what do you do if literal contains a quotation, for example O'Reily? The rule is, apostrophe inside the quoted string must be preceded by a second single quote. Thus, to produce the O string literal 'Reily, one must use 'O' Reily'. Now, back to dbms_xmlgen.get_xml. She waits for the SQL statement as a parameter. What SQL statement we want to produce? It would be:

    Select the text from user_views where view_name = "some-view-name."

    Right? Then, how the chain of the SQL statement above should look like? One way is to double single quotes:

    "Select the text from user_views where view_name =" some-view-name "'.

    But some-name-of-view is stored in the column of our query view_name. We have therefore concatenate the piecies which are:

    (1) text select lieral user_views where view_name = '
    (2) column view_name
    (3) literal '

    If we end up having:

    "Select the text from user_views where view_name ="' | view_name | ''''

    Now, you have replaced with solomon_is_cool view_name. This will not work because there is no solomon_is_cool column is user_views. What you probably wanted was:

    "Select the text from user_views where view_name ="solomon_is_cool"'.

    Then:

    dbms_xmlgen. GetXml ("select text from user_views where view_name ="solomon_is_cool"'") would look like to display user named solomon_is_cool text is tiny, which again could be a problem since the names, except between quotes, are stored in the data dictionary for uppercase. In any case, the counting of single quotes in string literals can be confusing. In the new versions of oracle introduced then Q-literals,

    dbms_xmlgen. GetXml ("select text from user_views where view_name =" "|") view_name | '''')

    could be replaced by more readable:

    dbms_xmlgen. GetXml (Q'[select text from user_views where view_name = ']' | view_name |) Q'[']')

    For example:

    SQL> select Q'[select text from user_views where view_name = ']' || view_name || Q'[']' from user_views where rownum < 3;
    
    Q'[SELECTTEXTFROMUSER_VIEWSWHEREVIEW_NAME=']'||VIEW_NAME||Q'[']'
    ------------------------------------------------------------------------------
    select text from user_views where view_name = 'EMP_VW'
    select text from user_views where view_name = 'REMOTE_DDL_VIEW_TEST'
    
    SQL> 
    

    SY.

  • to find the point where the user had fallen oracle

    Hi Experts,
    I have the request of my Auditor that it will be possible to find the time when the oracle user has been abandoned.

    Vesrion oracle 10g, 11g

    We can find it through the audit trail, or there is some dynamic combined opinions that maintains this information.


    Or other wise, that we create some manually trigger to enter the time, in the affirmative, please provide the details of the same


    A quick response will be useful...

    See here: 11.2.0.1 Windows XP

    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> select username from dba_audit_trail
      2  where
      3  action=53;
    
    no rows selected
    
    SQL> show parameter audit;
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    audit_file_dest                      string      E:\APP\SERVERROOM\ADMIN\ORCL\A
                                                     DUMP
    audit_sys_operations                 boolean     FALSE
    audit_trail                          string      DB_EXTENDED
    SQL> audit drop user;
    
    Audit succeeded.
    
    SQL> create user test identified by test;
    
    User created.
    
    SQL> drop user test;
    
    User dropped.
    
    SQL> column sql_text for a50;
    SQL> set line 200;
    SQL> select username,
      2  timestamp,
      3  sql_text
      4  from dba_audit_trail
      5  where
      6  action=53
      7  /
    
    USERNAME                       TIMESTAMP SQL_TEXT
    ------------------------------ --------- --------------------------------------------------
    SCOTT                          30-APR-12 drop user test
    SQL>
    

    So the answer is action = 53 in dba_audit_trail for user to drop and user specific just add like operator with column sql_text. means, scott user droped the user test on April 30, 12.

    If you want to know the meaning of the action column of the dba_audit_trail then see link below:
    http://docs.Oracle.com/CD/B19306_01/server.102/b14237/dynviews_2088.htm#g1432037
    Command.v$ session = action.dba_audit_trail

    If this answers your question, please close the message, otherwise continue.

    Concerning
    Girish Sharma

  • Brush sometimes loses the dynamics of the form of a sudden

    My brush sometimes loses momentum in the form of a sudden, so I get a blob in paint and then it continues with the work of shape dynamics.  I don't know where to start looking to solve this problem.  I use Windows7 Open active Gl CS5 and have my cache and memory higher than the standard recommendations in the cases where this rule is part of the problem.

    Any ideas to fix this?

    Thank you.

    This is the case, I think, where you really don't want pilots to be up-to-date.

    Something very similar to what you state is shown here from time to time.  Workaround seems to be to go to the Wacom site and download slightly older drivers 6.15.

    See: http://forums.adobe.com/message/3520412#3520412

    I hope it works for you.

    -Christmas

  • How to operate the same instance of oracle 10g on another computer

    Hello all, sorry for my ignorance. I downloaded oracle 10g express edition on 2 computers but when I login using sql developer I get two different instances of oracle databases. This file should I change on one of the computers so that when I connect through sql developer im always on the same database. Is there is tns.ora of files that I have to do the same thing on my other machine? Any help would be appreciated.

    user633029 wrote:
    I downloaded oracle 10g express edition on 2 computers but when I login using sql developer I get two different instances of oracle databases. This file should I change on one of the computers so that when I connect through sql developer im always on the same database.

    Hello!

    I don't know I understand your condition?

    But, if so:

    You have 2 computers and the two you want to access a single Oracle database.

    If this fix then you should only on a single machine to install server XE and another machine THAT XE Client.

    After that, you have to copy the file tnsnames.ora to computer where XE server resides at according to the directory where client XE.

    HTH

  • schedule the automatic start of oracle 10g R2 on RHEL5

    Hi master,

    I use oracle 10g R2 on RHEL 5. I want to program the automatic start of the oracle on linux start database.

    for that I have referefed the docs and plan its in the file/etc/rc3.d. but it does not work.

    It is written in the docs that this charger friub fron of process this file and start their beds according to their number.

    the file is as follows...

    #! / bin/sh
    #chkconfig: 346 99 10
    Description #: Oracle automatic start-stop script.
    #
    # Change the value of ORACLE_HOME to specify the right Oracle home
    # To your installation directory.

    ORACLE_HOME=/U01/app/Oracle/product/10.2.0/Db_1
    #
    # Change the value of the ORACLE of the connection of the
    owner of oracle # on your site.
    #
    ORACLE = oracle

    PATH = ${PATH}: $ORACLE_HOME/bin
    HOST = "hostname".
    Platform = 'uname '.
    export ORACLE_HOME PATH
    #
    If [!] "$2" = "ORA_DB"]; then
    If ['$PLATFORM' = "HP - UX"]; then
    Remsh $HOST-l $ORACLE n ' $0 $ 1 ORA_DB.
    output
    on the other
    rsh $HOST-l $ORACLE $0 $ 1 ORA_DB
    output
    FI
    FI
    #
    case $1 in
    'Start')
    $ORACLE_HOME/bin/dbstart $ORACLE_HOME
    ;;
    'stop')
    $ORACLE_HOME/bin/dbshut $ORACLE_HOME
    ;;
    *)
    echo "use: $0 {start |}". stop}.
    output
    ;;
    ESAC
    #
    output

    What should I look for?

    my listening service is also not automatically get started. I have to manually...

    any suggestion?

    Thanks and greetings
    VD

    Published by: vikrant dixit on December 23, 2008 21:58

    VD,
    This link willl helpp
    http://www.Oracle-base.com/articles/Linux/AutomatingDatabaseStartupAndShutdownOnLinux.php
    HTH
    Aman...

  • dynamice where the Cursor For loop clause

    Hi all

    I have a cursor based as logic:

    FOR temp IN (SELECT colname FROM WHERE whereconditions mytablename)
    loop
    .
    .
    .
    end loop;

    Is there anyway that I can do the whole dynamic WHERE clause?

    My where clause should exist only when a certain condition is met. Please help me.

    Thank you
    Chaitanya

    No, it wouldn't. Performance of:

    open temp for 'select clause'
    loop
    fetch into..
    exit when (temp%notfound);
    merge logic....
    end loop;
    

    would be no different from:

    for rec in cur loop
    merge logic....
    end loop;
    

    SY.

  • How to clone of pre-production to the production database in Oracle 10g?

    I'm a newbie DBA and gave me this task to clone a primary DB environment preprodcution of Production environment. I tried Googling, but all other positions have different and confusing steps. Can someone help me get the exact steps please?

    sweetritz wrote:

    Hi EdStevens,

    I'm a newbie Oracle DBA. Yes prod server has a database running on it and I want to clone a DB of preproduction on the Prod as an extra DB server (fusion has not any data with any DB existing).

    then I would say rman DUPLICATE DATABASE is your best choice.  And it does not require the Pb of pre-production to be arrested, only that you take backups rman (Yes, online backups work as long as you have the necessary archivelog files.)

  • Engage with the new Option in Oracle 10g

    Hi Experts,

    Help me understand validation options introduced in Oracle 10 g

    COMMIT TO WAIT WRITING;
    COMMIT SCRIPTURE NOWAIT.
    COMMIT SCRIPTURE BATCH;
    COMMIT IMMEDIATE WRITING;

    Can anyone share these option everything works (Pros & Cons) and when to use this option.

    Although I went through various and below two links are one of them, but still doubts are not clearly properly or provide a specific link that could help dig.

    http://www.Oracle-base.com/articles/10G/commit-10gR2.php
    http://docs.Oracle.com/CD/B19306_01/server.102/b14200/statements_4010.htm

    Thank you
    Dax

    Dax-Oracle wrote:

    Can anyone share these option everything works (advantages & disadvantages) and when should you use this option.
    Although I went through various and below two links are one of them, but still doubts are not clearly properly or provide a specific link that could help dig.

    Oracle manual explains each option fairly well.

    What don't you get no description of these options Manual? You have a specific scenario in mind that you think may warrant not to use by default?

  • How to manipulate the NCLOB values in oracle 10g?

    Hi Experts,
    I have a scenario where I have to show the output of the screen multi language. IM using plsql developer, my plsql block should show the report of multi language.
    Root table have multi language stirng stored in it with the NCLOB data type. In my block plsql, im in NCLOB variable(ex: var1) selection. When I insert as var1 in other tables of test with nclob column, it's showing the original text in multi language. But when I manipulate than with some other variables var1 (ex: var3: = var2 | var1), now if I insert additional tables var3 it inserts as var2? value. and even in the DBMS output as well.
    Please help me to get the original value of multi language. Or guide me to manipulate variables nclob.

    Have you tried DBMS_LOB. ADD?

  • Case where the Condition when Clause Condition use

    Hello

    How can I use case in the where condition and in when I need to use a condition, be clearly
    I need to get the following
    and (case WHEN :PROMT = 'Closed' then
     status_date >= trunc(sysdate))  end)
    When I run the present, I'm missing keyword error.

    How can I solve this?

    I think you can do it just like this:

    ...
    and ( :PROMPT != 'Closed' or status_date >= trunc(sysdate) )
    ...
    
  • How to check the table reused in oracle 10g space?

    Hello..

    Of my system, I see table size keep growing event the deletion request is running. Because of this, I would like to check either the allowed oracle to reuse space table or not? If not then how can I enable it?


    Please help me...


    Thank you
    Balleur

    You can use dbms_space.space_usage to check for free space.

    Reuse of the space will depend on whether you use MSSM or SAMS, PCT_FREE, PCT_USED and the way in which new data is inserted?

    You can reduce or move the table and rebuild the index to reclaim space.

  • form of the browser for oracle 10g support

    Hi gurus,
    I have browser i.e internet explore 8, browser mozilla firefox 3.0.11, netscape 9.0.0.6, opera 10.61, google chrome 6.0.472.53.
    forms of Oracle runs correctly on IE 8, 3 Mozilla, Netscape 9
    but it does not work on Google chrome and Opera browsers

    If I want to run the forms on chrome and Opera then what the needs are and what are the other browsers support Oracle 10g form.

    answer please...

    Check this page for the certification of the platform of the client:
    http://www.Oracle.com/technetwork/middleware/IAS/downloads/as-certification-R2-101202-095871.html#BABGCBHA

Maybe you are looking for