Form on a SQL Query - doesn't work with SELECT * - bug or feature ?

When I do this,
Create Page -> Page with Component -> Form -> Form on a SQL Query -> SELECT * FROM EMP
I do not get any items displayed and it creates a simple HTML region / page. Do we have to necessarily specify the column names ?
Iam looking at a way to see if any addition of columns in the table does not involve IT intervention in recreating the form.
When we try to create with Form on a SQL Query, then shouldn't it be similar to the Report where the same thing works, if I give SELECT function_returning_columns() from DUAL even then the same thing happens where it creates an ITEM called functions_returning_columns() it creates HTML region
I asked a related question with no answer :-( in
Dynamic Creation of Items in Runtime through Application UI

Hi Marc,
Thanks. I just tried something like this. Taking the EMP table example, (it doesn't matter which table), I created a region based on a Pl/Sql function returning SQL query
( I selected the vertical report template including nulls to display it like a form ) :
DECLARE
v_sql VARCHAR2(3000) ;
mn_idx NUMBER := 1 ;
BEGIN
v_sql := 'SELECT ' ;
FOR recs IN (SELECT * FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = 'EMP' ORDER BY COLUMN_ID)
LOOP
v_sql := v_sql || 'HTMLDB_ITEM.TEXT(' || mn_idx || ',' ||
recs.column_name || ') ' || recs.column_name || ', ' ;
mn_idx := mn_idx + 1 ;
END LOOP ;
v_sql := SUBSTR(v_sql, 1, LENGTH(v_sql) -2) ;
v_sql := v_sql || ' FROM EMP WHERE EMPNO = 7369 ORDER BY 1 ' ;
RETURN v_sql ;
END ;
This allowed me to do my updates etc.., Then I created a button called 'Apply' and a process called 'update_changes' on button click and defined this:
DECLARE
v_sql varchar2(1000) ;
mn_ctr NUMBER := 1 ;
BEGIN
v_sql := 'BEGIN UPDATE EMP SET ' ;
FOR recs IN (select COLUMN_ID, COLUMN_NAME, DATA_TYPE
from all_tab_columns where table_name = 'EMP'
ORDER BY COLUMN_ID) loop
-- Make changes here if required- this is assuming 9 columns --
v_sql := v_sql || recs.column_name || ' = HTMLDB_APPLICATION.G_F0' || mn_ctr || '(1),' ;
mn_ctr := mn_ctr + 1;
end loop ;
v_sql := substr(v_sql, 1, length(v_sql) - 1) ;
v_sql := v_sql || ' WHERE EMPNO = 7369; END ;' ;
execute immediate (v_sql) ;
END ;
Since this is for example, I didn't include code for Checksum and hardcoded empno = condition and have provision for 9 columns. I made some changes and tried saving it and I was able to do it.
I altered the table to add a column / drop a column and when I relogin, Iam able to see the changes.
Can you tell me if there could be any drawbacks in this approach ?.

Similar Messages

  • SQL query doesn't work in VB program

    Hi:
    The following SQL query doesn't work into a VB program, I'm using Oracle OLEDB to established connection to the DB, ... the query returns 0 rows ...
    When I run this same query from any SQL Plus, works well (returning me something like 119 rows) ...
    Any clue or hint ??
    Thanks in advanced
    Angel Castro
    SELECT OPERADOR, ID_ALIMENTADOR, RB_FSC, NUM_CTROL, COND_OPERA, TRANSITORIO, PENDIENTES, ANORMAL, EDO_REAL, IDENTIFICADOR, CAUSA
    FROM HISTORICO_OPERACION
    WHERE (FECHA BETWEEN '20-AUG-2004' AND '5-NOV-2004')
    AND (HORA BETWEEN '10:00:00' AND '16:00:00')
    ORDER BY ID_ALIMENTADOR ASC;

    Is the column FECHA of datatype DATE?
    Are you running the query with the constant date looking like strings ('20-AUG-2004' in your post, for example) as-is from the VB program?
    If not, are you binding the parameters correctly?
    What is the setting of your NLS_DATE_FORMAT parameter?
    What happens if you do a
    ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'from your VB program before running the query?

  • SQL Query doesn't work coccrectly

    The table includes list of month and years.
    When I write
    SELECT MONTH,YEAR FROM MONTH_DETAILS ORDER BY YEAR DESC,MONTH DESC;
    it works correcty and returns
    MONTH YEAR
    7 2009
    6 2009
    5 2009
    4 2009
    3 2009
    2 2009
    1 2009
    12 2008
    11 2008
    But when I want to return only the first one(month=7 and year=2009) and change query like this
    SELECT MONTH,YEAR FROM MONTH_DETAILS WHERE ROWNUM=1 ORDER BY YEAR DESC,MONTH DESC;
    it returns
    MONTH YEAR
    2 2009
    what is the problem?
    Both month and year fields are defined as numbers.

    Your query should be
    SELECT MONTH
          ,YEAR
    FROM (
          SELECT MONTH
                ,YEAR
                ,ROWNUM row_num
            FROM MONTH_DETAILS
           WHERE ORDER BY YEAR DESC,MONTH DESC
    WHERE row_num  = 1; Regards
    Arun

  • SQL Procedure doesn't work with "current of cursor" Oracle 11g

    hi all
    i have written a procedure which should update every row for a given column on a given table.
    here is the code:
    CREATE OR REPLACE PROCEDURE "xxx"."loop_update_autowert_x"
    startwert number,
    column_name VARCHAR2,
    table_name varchar2
    AS
    stmt varchar2(2000);
    stmt2 varchar2(2000);
    zaehler number;
    sum_gesamt number;
    TYPE obj_ref_type IS REF CURSOR;
    obj_cur obj_ref_type;
    begin
    stmt2:='select rownum , rowid from ' || table_name || ' for update';
    OPEN obj_cur FOR stmt2;
    dbms_output.enable(1000000);
    dbms_output.put_line ('Startwert ist: ' ||startwert);
    dbms_output.put_line ('Column Name ist: ' ||column_name);
    dbms_output.put_line ('Table Name ist: ' ||table_name);
    loop
    fetch obj_cur into zaehler , my_rowid;
    exit WHEN obj_cur%NOTFOUND;
    sum_gesamt:=zaehler + startwert;
    stmt:='update ' || table_name || ' set ' || column_name || ' = ' || sum_gesamt || ' WHERE current of obj_cur';
    dbms_output.put_line (stmt);
    execute immediate stmt;
    end loop;
    close obj_cur;
    end;
    the error i get is:
    Anmeldung bei der Datenbank Oracle Test2.
    ORA-03001: Funktion nicht implementiert
    ORA-06512: in "xxx.loop_update_autowert_x", Zeile 29
    ORA-06512: in Zeile 10
    Startwert ist: 5
    Column Name ist: a
    Table Name ist: T
    update T set a = 6 WHERE current of obj_cur
    Prozess beendet.
    Abmeldung von der Datenbank Oracle Test2.
    have anybody an idea what is wrong or is this construction with the clause "open cursor for statement" not possible with where current of cursor
    thx for helping
    best regards
    Hans-Peter

    Hello
    You're using rownum in your query so why not just use it in the update?
    CREATE OR REPLACE PROCEDURE "xxx"."loop_update_autowert_x" (
       startwert      NUMBER,
       column_name    VARCHAR2,
       table_name     VARCHAR2)
    AS
       stmt         VARCHAR2 (2000);
    BEGIN
       DBMS_OUTPUT.enable (1000000);
       DBMS_OUTPUT.put_line ('Startwert ist: ' || startwert);
       DBMS_OUTPUT.put_line ('Column Name ist: ' || column_name);
       DBMS_OUTPUT.put_line ('Table Name ist: ' || table_name);
          stmt :=
                'update '
             || table_name
             || ' set '
             || column_name
             || ' = ROWNUM + :startwert'
          DBMS_OUTPUT.put_line (stmt);
          EXECUTE IMMEDIATE stmt USING startwert;
    END;Wherever possible, I would suggest you try to avoid dynamic SQL as it hides dependencies and so can make maintenance more difficult.
    Also, it's not a great idea to splatter your code with DBMS_OUTPUT all over the place. It's better to wrap it in something so you have a bit of control over when it is used - something like log4plsql would be an example...
    HTH
    David

  • HTML DB 2.0 SQL Workshop doesn't work with Firefox

    I have installed version 2, and all is well in I.E, however if I use firefox (1.0.x, 1.4.x, 1.6.x) it is impossible to browse or create objects as the required fields and buttons do not appear.
    I have tried this on a number of v2 HTML DB installations and the behaviour is the same.
    I haven't noted many other posts on this so I am just wondering whether it is only me having the problem, or if everyone is still on 1.6

    Hi Carl,
    Yeah, the version numbering 1.4 and 1.6 are the alpha and beta builds of Firefox.
    After doing a complete clean re-install of FIrefox 1.07 (release version) and a new profile, I still get the same behaviour. However, testing on htmldb.oracle.com, I get the correct behaviour, so it appears to be a problem with the version 2 installations I have done. May be HTTP server version.

  • 9-slice scaling doesn't work with rotation - bug!

    I have a simple graphic, a rectangle with 3 rounded corners with 9-slice scaling applied. When I scale it non-proportionally, the round corners keep their shape as expected. BUT if I then rotate it the round corners lose their shape and become ellipticaly distorted! If I rotate first and then scale the same thing happens. WT...??

    you're correct.
    it doesn't matter whether the scale9Grid is created in the ide or with actionscript.
    it's probably been reported because i think that's been a problem for a long time:  https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • HP LaserJet M1522nf scanner doesn't work with Windows 10 scan feature

    I used the instructions from Honor Student to get my scanner going.  However, I did not see "Shell Hardware Detection" anywhere. Please advise!

    Hi @inetdude 
    Since there is no full feature software and driver for 8 or 8.1, I am not sure what else to suggest other than for you to reach out to Microsoft. The driver you are using is an in-OS driver, perhaps they can help you.
    Microsoft Community
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • SQL Query (PL/SQL Function Body returning SQL query) doesn't return any row

    I have a region with the following type:
    SQL Query (PL/SQL Function Body returning SQL query).
    In a search screen the users can enter different numbers, separated by an ENTER.
    I want to check these numbers by replacing the ENTER, which is CHR(13) || CHR(10) I believe, with commas. And then I can use it like this: POD IN (<<text>>).
    It's something like this:
    If (:P30_POD Is Not Null) Then
    v_where := v_where || v_condition || 'POD IN (''''''''||REPLACE(''' || :P30_POD || ''', CHR(13) || CHR(10), '','')||'''''''''')';
    v_condition := ' AND ';
    End If;
    But the query doesn't return any rows.
    I tried to reproduce it in Toad:
    select * from asx_worklistitem
    where
    POD IN (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
    ==> This is the query that does't return any rows
    select (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
    from dual;
    ==> This returns '541449200000171813','541449206006341366'
    select * from asx_worklistitem
    where pod in ('541449200000171813','541449206006341366');
    ==> and when I copy/paste this in the above query, it does return my rows.
    So why does my first query doesn't work?
    Doe anyone have any idea?
    Kind regards,
    Geert
    Message was edited by:
    Zorry

    Thanks for the help.
    I made it work, but via the following code:
    If (:P30_POD Is Not Null) Then
    v_pods := REPLACE(:P30_POD, CHR(13) || CHR(10));
    v_where := v_where || v_condition || 'POD IN (';
    v_counter := 1;
    WHILE (v_counter < LENGTH(v_pods)) LOOP
    v_pod := SUBSTR(v_pods, v_counter, 18);
    IF (v_counter <> 1) THEN
    v_where := v_where || ',';
    END IF;
    v_where := v_where || '''' || v_pod || '''';
    v_counter := v_counter + 18;
    END LOOP;
    v_where := v_where || ')';
    v_condition := ' AND ';
    End If;But now I want to make an update of all the records that correspond to this search criteria. I can give in a status via a dropdownlist and that I want to update all the records that correspond to one of these POD's with that status.
    For a region you can build an SQL query via PL/SQL, but for a process you only have a PL/SQL block. Is the only way to update all these records by making a loop and make an update for every POD that is specified.
    Because I think this will have a lot of overhead.
    I would like to make something like a multi row update in an updateable report, but I want to specify the status from somewhere else. Is this possible?

  • Form on a SQL Query

    Hi there,
    I've created a "Form on a SQL Query" using the example database and query example:
    select e.empno, e.ename, e.job, e.hiredate, e.sal, d.dname
    from emp e, dept d
    where e.deptno = d.deptno
    which works fine. But suppose I want to modify the query? Where can I find it? Or is the only thing you can do is to delete the form region (and corresponding items and buttons) and start all over again?

    I am also having this problem. If the query can't be viewed or modified as a matter of design (why?), just let me know.
    I can't find the answer in any of the APEX documentation I've looked at. And it took me forever to find this unanswered thread that's over a year old.

  • Buckup SQL Script doesn't work

    Hi  all,
    In ECC i want schedule ASE jobs to  dump transaction logs,i do it fellow the note 1588316 step by step .  In  schedule jobs my sql script doesn't work,but it works in sql command line.
    sql script :
    dump transaction DEV using config= 'DEVLOG'
    Anybody can give me some advise to face this issue?  Thanks in advance.
    David Lv

    Hi  all,
    My problem sloved, it's JSagent problem.
    sp_dumptrans not working at dbacockpit @Alcino Melo
    use sybmgmtdb
    go
    sp_js_wakeup "start_js",1
    go
    after start  JSagent  my sql script can run 
    Thanks  all
    David Lv

  • The query doesn't work

    Hi kind people!
    I have udf  TEST on the picture. The query on the picture I have connected to the field Test and conected to field description too. But with the field Description the query doesn't work. U_Producer is the name of another field. Why does not it work?

    Hi Gordon!
    From the right I have UDF for choosing the spare parts of auto.  I want to add a spare part, for example to item master data (OITM). I enter every field step by step 1 - 4 by choosing frome use tables linked in every field. I choose fielf 1 (Brand) for example TOYOTA and in the use table of 2(Model) field i see only values that belong to TOYOTA that to say corolla, carina, vista and so on.  But to find any component  exactly i put on the loupe in the field 5 and see a table where all types of auto parts in the world but they are filtered with parametrs in 1-4 fields. I chhose needed component and get in the 5 field any code of a choosed part. Then i d liked to link the table of filed 5 to field Description too and to filter component with code in field 5 in order to get item description from the use table. I used the one method of filtering in all fields Here i see that i can to filter values using use fields but I don't use it in standart field description, although the usual selection of elements of any use table works. As a result a see that the problem that doesn't work the selection and filtration in the field description but it works in in UDF.

  • The DB tools doesn't work with Microsoft SQL

    I am tring to write series of waveforms to a database. The DB tools doesn't work with Microsoft SQL, but when i replace the SQL with Access, it works fine. I have to use SQL in the application.
    Any advice pls?
    longing for your reply.
    Attachments:
    test.vi ‏47 KB

    Right off hand I would say the problem is that you are connecting through ODBC. Try the native SQL Server driver, your connect string should define the provider as "SQLOLEDB.1".
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • IPhone original doesn't work with Belkin TuneBase FM after 2.0.1 update

    iPhone original doesn't work with Belkin TuneBase FM after 2.0.1 update

    Firstly, XE 10.2.0.1 isn't the same as 10gR2 10.2.0.1
    It was released a bit later and had some fixes that were in later 10.2.0.x patchsets (and also had some different security settings). Maybe they should have gone with 10.2.1.1.
    Second, the embedded PL/SQL gateway was okay for XE, but isn't supported for Apex on the Standard/Enterprise Edition until 11g. It doesn't mean it never works, but it does mean that you shouldn't rely on it.
    That said, there are other issues with 10.2.0.1 so I'd recommend going for the latest patchset anyway.
    Thirdly, if you get the XDB login dialog box, something has gone wrong. For the embedded PL/SQL gateway, XDB is acting as a virtual webserver. Generally what should happen is you connect to the webserver (XDB) and request a page (the APEX login page) and XDB should give it to you, no questions asked.
    If it asks you to login then the XDB webserver is running but is trying to get authorisation before it gives you the page. [By the way, if it does prompt for a username/password, it is expecting a database username/password, not an apex one or an O/S one] I'd suspect something is wrong with the setup.
    What happens if you ask for a simple image like
    http://URAN:8080/i/bottom_left.gif

  • Trying to load illustrator 6cs onto new mac and the old activation code for my ill cs doesn't work with it

    Trying to load a downloaded version of illustrator 6cs onto new mac and the old activation code for my illustrator cs doesn't work with it.  Do I need a new code or am I missing something?  Same goes for my Photoshop cs.

    you need your serial number.
    if you purchased from or registered with adobe check your account, https://www.adobe.com/account.html

  • Cinema Display (clear) with DVI/ADC box doesn't work with MacBook Pro

    Cinema Display (clear) with DVI/ADC box doesn't work with MacBook Pro when plugged in with a dvi to mini dvi cable. Any ideas what to do to make it work? I lugged the 23" 2500 miles into the wilderness and I need help

    Okay, here's an update: the DVI to ADC adapter does work with the Apple displays that I have tried, but it won't work with the Formac. I have tried multiple time to contact them, but to no avail... they don't even respond to threats of posting my opinion of them, which is this:
    DON'T BUY ANYTHING FROM FORMAC! They make quality products, but their customer service is a big time joke! They won't take care of you.

Maybe you are looking for