Design of the dynamic schema through SQL
Hi allIs it possible to design a dynamic schema using SQL?
Documents or links is greatly appreciated.
Thank you
Hello
Sorry, I don't get you. Design of a scheme is more than dynamic SQL, you must think of tables, relationships, constraints, standardization, etc.. On the dynamic SQL statements, see [using dynamic SQL statements | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/dynamic.htm#CACDDACH]
Kind regards
Tags: Database
Similar Questions
-
The dynamic LOV PL/SQL syntax help
Hello
I am trying to create a dynamic lov pl/sql Oracle Apex 3.2 on 11 g. I'm having some trouble with the syntax of the statements below and I would be grateful for any suggestion.
I'm trying to shape the code above out of the example given by apex:DECLARE BEGIN IF :p3_current_a_workshop != 0 THEN RETURN 'select distinct workshop_title ||': ' || presenter_name ||' $'|| workshop_fee display_value, workshop_id return_value from WORKSHOP where session_time = 'A' and workshop_status = 'Open' or workshop_id = :p3_current_a_workshop order by 1'; ELSE RETURN 'select distinct workshop_title ||': ' || presenter_name ||' $'|| workshop_fee display_value, workshop_id return_value from WORKSHOP where session_time = 'A' and workshop_status = 'Open' order by 1'; END IF; EXCEPTION WHEN OTHERS THEN HTP.PRN('ERROR'||SQLERRM); END;
~ Andrew SchultzA function that returns a SQL query with two columns: IF :MY_ITEM='10' THEN RETURN 'SELECT ename, empno FROM emp WHERE depno = 10 ORDER BY 1'; ELSE RETURN 'SELECT ename, empno FROM emp WHERE depno = :my_item ORDER BY 1'; END IF;
How do you use this procedure?
You can create and example on apex.oracle.com?
Lev
Published by: the January 12, 2011 14:10
-
Call the recursive procedure through sql
Currently, I need to implement a report on GIS. The report should be called in a statement "select of.
Here is the initial request, I wrote. The query has been compiled successfully and the return of the expected values. Note that it is recursive.
----------------------------------------------------------------------
Recursive procedure
----------------------------------------------------------------------
CREATE OR REPLACE PROCEDURE FIND_RELATIONSHIP (SEARCH_CRITERIA CUST_PERSON_TABLE_TEST. CUST_ID % TYPE, INPUT_RELATIONSHIP IN VARCHAR2)
IS
NUMBER OF RETURN_REC;
TYPE XYZ_1 IS REF CURSOR CUST_PERSON_TABLE_TEST RETURN % ROWTYPE;
CURSOR_PRCI XYZ_1;
PRCI_FIELD1 CUST_PERSON_TABLE_TEST % ROWTYPE;
METER NUMBER;
OUT_RELATIONSHIP VARCHAR2 (100);
PASS_VAL CUST_PERSON_TABLE_TEST. CUST_ID % TYPE;
BEGIN
COUNTER: = 1;
CURSOR_PRCI OPEN FOR SELECT * FROM CUST_PERSON_TABLE_TEST WHERE CUST_ID = SEARCH_CRITERIA;
EXTRACT THE CURSOR_PRCI IN PRCI_FIELD1;
LOOP
When the output CURSOR_PRCI % NOTFOUND;
OUT_RELATIONSHIP: = INPUT_RELATIONSHIP |'. ' || METER;
DBMS_OUTPUT. PUT_LINE (OUT_RELATIONSHIP |') -' || PRCI_FIELD1. PERSON_RELTN_CUST_ID |' -' || PRCI_FIELD1. PERSON_RELTN_NAME |' -' || PRCI_FIELD1. CUST_RELTN_CODE);
PASS_VAL: = PRCI_FIELD1. PERSON_RELTN_CUST_ID;
FIND_RELATIONSHIP (PASS_VAL, OUT_RELATIONSHIP);
EXTRACT THE CURSOR_PRCI IN PRCI_FIELD1;
COUNTER: = COUNTER + 1;
END LOOP;
CLOSE CURSOR_PRCI;
END;
SET SERVEROUTPUT ON
DECLARE
BEGIN
DBMS_OUTPUT. PUT_LINE('1.) OF1061769');
FIND_RELATIONSHIP('OF1061769','1');
END;
/
According to some articles, we cannot call a procedure with a select statement, so I had to convert to a function. It can be compiled, but when the select is a failure.
----------------------------------------------------------------
Converted to a function procedure
----------------------------------------------------------------
CREATE OR REPLACE PACKAGE IN THE RELATIONSHIP_PKG
TYPE OUTPUT_RELATIONSHIP IS (RECORD
OUT_RELATIONSHIP VARCHAR2 (100),
PERSON_RELTN_CUST_ID VARCHAR2 (BYTE 9),
PERSON_RELTN_NAME VARCHAR2 (80 BYTE),
CUST_RELTN_CODE VARCHAR2 (5 BYTE));
TYPE T_O_RELATIONSHIP IS TABLE OF THE OUTPUT_RELATIONSHIP;
FUNCTION FIND_RELATIONSHIP (SEARCH_CRITERIA VARCHAR2, VARCHAR2 INPUT_RELATIONSHIP)
RETURN T_O_RELATIONSHIP;
END;
/
CREATE OR REPLACE PACKAGE BODY RELATIONSHIP_PKG AS
FUNCTION FIND_RELATIONSHIP (SEARCH_CRITERIA IN VARCHAR2, INPUT_RELATIONSHIP IN VARCHAR2)
T_O_RELATIONSHIP IS back
FEED_DATA OUTPUT_RELATIONSHIP;
NUMBER OF RETURN_REC;
TYPE XYZ_1 IS REF CURSOR CUST_PERSON_TABLE_TEST RETURN % ROWTYPE;
CURSOR_PRCI XYZ_1;
PRCI_FIELD1 CUST_PERSON_TABLE_TEST % ROWTYPE;
METER NUMBER;
OUT_RELATIONSHIP VARCHAR2 (100);
PASS_VAL CUST_PERSON_TABLE_TEST. CUST_ID % TYPE;
BEGIN
COUNTER: = 1;
CURSOR_PRCI OPEN FOR SELECT * FROM CUST_PERSON_TABLE_TEST WHERE CUST_ID = SEARCH_CRITERIA;
EXTRACT THE CURSOR_PRCI IN PRCI_FIELD1;
LOOP
When the output CURSOR_PRCI % NOTFOUND;
OUT_RELATIONSHIP: = INPUT_RELATIONSHIP |'. ' || METER;
-DBMS_OUTPUT. PUT_LINE (OUT_RELATIONSHIP |') -' || PRCI_FIELD1. PERSON_RELTN_CUST_ID |' -' || PRCI_FIELD1. PERSON_RELTN_NAME |' -' || PRCI_FIELD1. CUST_RELTN_CODE);
SELECT OUT_RELATIONSHIP, PRCI_FIELD1. PERSON_RELTN_CUST_ID, PRCI_FIELD1. PERSON_RELTN_NAME, PRCI_FIELD1. CUST_RELTN_CODE IN DOUBLE FEED_DATA;
-PIPE ROW (FEED_DATA);
PASS_VAL: = PRCI_FIELD1. PERSON_RELTN_CUST_ID;
-BACK RELATIONSHIP_PKG. FIND_RELATIONSHIP (PASS_VAL, OUT_RELATIONSHIP);
EXTRACT THE CURSOR_PRCI IN PRCI_FIELD1;
COUNTER: = COUNTER + 1;
END LOOP;
CLOSE CURSOR_PRCI;
END FIND_RELATIONSHIP;
END;
/
But when running.
SELECT * from table (RELATIONSHIP_PKG. FIND_RELATIONSHIP('OF1061769','1'))
I get invalid data type
EXEC RELATIONSHIP_PKG. FIND_RELATIONSHIP('OF1061769','1');
Above code returns Find_relationship is not a procedure or is undefined ORA06550.
Can anyone advise me on the conversion of the work to a function procedure, as FIND_RELATIONSHIP(PASS_VAL,OUT_RELATIONSHIP) wrote in the service fails.
Or someone help me hidden in a function that can be called in a select statement.
What you wrote, it seems that it is possible using a hierarchical query.
Why don't you start with a small "CREATE TABLE" and some "INSERT" statements followed by your desired results.
Re: 2. How can I ask a question in the forums?
Thank you
MK
-
How to choose the last rate in SQL?
Dear friends,
I have a table named pr_master
There are the item_id, pr_date, and item_rate fields in the table
data are as below
item_id pr_date item_rate
21 01/01/2014 50
21 01/05/2014 45
01/09/2014 21, 44
01/05/2014 25, 115
15/01/2014 25, 110
17/01/2014 25, 125
I want the maximum date through SQL for specific item rate.
Any1 can help. Thanking you.
Kind regards
with
pr_master as
(select 21 item_id, to_date('01-01-2014','dd-mm-yyyy') pr_date, 50 item_rate union double all the)
Select 21, to_date (May 1, 2014 "," dd-mm-yyyy ""), 45 union double all the
Select 21, to_date (September 1, 2014 "," dd-mm-yyyy ""), 44 Union double all the
Select 25, to_date (May 1, 2014 "," dd-mm-yyyy ""), 115 union double all the
Select 25, to_date (15 January 2014 "," dd-mm-yyyy ""), 110 union double all the
Select 25, to_date (January 17, 2014 "," dd-mm-yyyy ""), 125 of the double
)
Select item_id, pr_date, item_rate
of (item_id, pr_date, item_rate, row_number (select) on rn (partition by item_id arrested by pr_date desc)
of pr_master
)
where rn = 1
ITEM_ID PR_DATE ITEM_RATE 21 09/01/2014 44 25 17/01/2014 125 Concerning
Etbin
-
Time of design and of the dynamically created controls
I have a project written in VC6 as a project of the MFC dialog box. In a particular area, I dynamically create several (the exact number depends on user input) CNiGraphs. There is also a two CNiButtons that were created at design time using the resource editor. The problem I have is that when this dialog box is open, a message appears saying it is an eval version and the control will go off after 5 minutes. After 5 minutes of waiting, the CNiButtons 2 go inactive (black tower), but the continuous CNiGraphs of work. I have a valid license of MStudio 8.1.6, version but it seems that these 2 buttons do not recognize the license. There are also other buttons from the moment of conception of the project, but these have no problem at all. When you create the dynamic creation of the CNiGraphs, give them a valid license string, and I was wondering if there is a problem with the time created and dynamically controls created in the same dialog box to design. Anyone know?
I don't remember, but I can have created these 2 CNiButtons when I was with only an eval license. (All others were undoubtedly create when I got a full license) Could have an impact on them? I have a vague memory of reading somewhere that DTC create controls to check the license when they are created in the designer and store that info in them license. If this is the case does anyone know an easy way to update the license stored in control? I rather not just delete it and Add again because I would avoid having to redo the tab order (unless someone knows how to easily insert something in the middle of the order of tab instead of having to click through all the controls in the correct order)?
In addition, I don't know if this would affect anything, but the project was originally built with ComponentWorks 1.0, we were forced to move to MStudio when we met a few bugs in CW, so all controls were originally CW controls which have been converted into control of CNi. I doubt that this is so like everywhere else, we changed during controls is not a problem, but I'm ready to try the suggestions.
Hi JC,.
I hope you had a good weekend! I'm glad to hear that you're back running. Add the extra button was, in fact, causing update the licensing information for the other buttons, as you can imagine. After further research, I found that the license information are stored only the form of the control, and if this control doesn't change in any way (or in your case, adding a new project), he sees no reason when compiling to recreate a link to the license. However, after the change of control and a new, it updates the link between the license information, which solved this problem in your case.
I hope this helps, JC. Have a great day!
-
Create the directory in the operating system through PL/SQL
Hi gurus,
I'm creating a procedure to automate the creation of the external tables and Oracle (using the dynamic SQL) directories.
I wonder if it is possible to create the directory in the operating system through the procedure.
As in SQL more
SQL > host mkdir/oracle/test
THX,
Levi Pereirahttp://www.Oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
http://asktom.Oracle.com/pls/asktom/f?p=100:11:4500682002852519:P11_QUESTION_ID:952229840241 -
Hello
How can I use statistics for all the tables in a schema in SQL Developer? and how long will it take on average?
Thank you
Jay.
Select the connection and right-click on it and select schema statistics collection
-
Error loading XML file in the column of XMLTYPE through SQL loader
Hi gurus,
I am trying to load the XML file into the column of XMLTYPE through SQL Loader but the errors themselves. Here are the details
Databases
The table structureSQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 24 17:17:55 2012 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Release 10.2.0.3.0 - 64bit Production BANNER ---------------------------------------------------------------- Oracle Database 10g Release 10.2.0.3.0 - 64bit Production PL/SQL Release 10.2.0.3.0 - Production CORE 10.2.0.3.0 Production TNS for Linux: Version 10.2.0.3.0 - Production NLSRTL Version 10.2.0.3.0 - Production
XML (simple.xml) fileCREATE TABLE TH_XML ( COL_ID_1 VARCHAR2(100 BYTE), IN_FILE_1 XMLTYPE ) XMLTYPE IN_FILE_1 STORE AS CLOB (TABLESPACE SMDAT)
Control file<?xml version="1.0"?> <catalog> <book id="bk101"> <author>Some Author1</author> <title>Some Title1</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>creating applications</description> </book> <book id="bk112"> <author>Some Author2</author> <title>Some Title2</title> <genre>Computer</genre> <price>49.95</price> <publish_date>2001-04-16</publish_date> <description>Microsoft Visual Studio 7 is explored in depth</description> </book> </catalog>
LOG fileLOAD DATA INFILE 'c:\simple.xml' APPEND INTO TABLE TH_XML XMLTYPE(in_file_1) ( col_id_1 filler CHAR (100), in_file_1 LOBFILE(CONSTANT "c:\simple.xml") TERMINATED BY EOF )
I get error ORA-00904: "SYS_NC_ROWINFO$": invalid identifier in the logfile (mentioned above). Could someone help me know where I am doing wrong?SQL*Loader: Release 10.2.0.3.0 - Production on Tue Jul 24 16:42:25 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Control File: c:\my_file.ctl Data File: c:\simple.xml Bad File: c:\simple.bad Discard File: none specified (Allow all discards) Number to load: ALL Number to skip: 0 Errors allowed: 50 Bind array: 64 rows, maximum of 256000 bytes Continuation: none specified Path used: Conventional Table TH_XML, loaded from every logical record. Insert option in effect for this table: APPEND Column Name Position Len Term Encl Datatype ------------------------------ ---------- ----- ---- ---- --------------------- COL_ID_1 FIRST 100 CHARACTER (FILLER FIELD) IN_FILE_1 DERIVED * EOF CHARACTER Static LOBFILE. Filename is c:\simple.xml Record 1: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 2: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 3: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 4: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 5: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 6: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 7: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 8: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 9: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 10: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 11: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 12: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 13: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 14: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 15: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 16: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 17: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 18: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 19: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 20: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 21: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 22: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Record 23: Rejected - Error on table TH_XML. ORA-00904: "SYS_NC_ROWINFO$": invalid identifier Table TH_XML: 0 Rows successfully loaded. 23 Rows not loaded due to data errors. 0 Rows not loaded because all WHEN clauses were failed. 0 Rows not loaded because all fields were null. Space allocated for bind array: 256 bytes(64 rows) Read buffer bytes: 1048576 Total logical records skipped: 0 Total logical records read: 23 Total logical records rejected: 23 Total logical records discarded: 0 Run began on Tue Jul 24 16:42:25 2012 Run ended on Tue Jul 24 16:42:26 2012 Elapsed time was: 00:00:00.23 CPU time was: 00:00:00.05
Thanks in advance.
Published by: 876991 on 24 July 2012 14:18Hello
This remove the control file:
XMLTYPE(in_file_1)
It is used only if the target table is an array of XMLType object.
For an XMLType column LOBFILE is sufficient, for example:
LOAD DATA INFILE * APPEND INTO TABLE TH_XML ( col_id_1 CHAR (100), in_file_1 LOBFILE(CONSTANT "c:\simple.xml") TERMINATED BY EOF ) begindata MYID1
It tells SQL * Loader data consisting of one record with COL_ID_1 = "MYID1" and content = "c:\simple.xml" IN_FILE_1
SQL> CREATE TABLE TH_XML 2 ( 3 COL_ID_1 VARCHAR2(100 BYTE), 4 IN_FILE_1 XMLTYPE 5 ); Table created. SQL> host sqlldr control=test.ctl Username:dev Password: SQL*Loader: Release 11.2.0.2.0 - Production on Mer. Juil. 25 01:30:46 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Commit point reached - logical record count 1 SQL> set long 5000 SQL> column col_id_1 format a15 SQL> select * from th_xml; COL_ID_1 IN_FILE_1 --------------- -------------------------------------------------------------------------------- MYID1
Some Author1 Some Title1 Computer 44.95 2000-10-01 creating applications Some Author2 Some Title2 Computer 49.95 2001-04-16 Microsoft Visual Studio 7 is explored in depth -
The combination of several lines to line of monkey through SQL Stmt
Hello
I try to combine the values returned by several rows in a row,
through indoor/outdoor sql or any optimally.
In the example, I would like to have name, surname, email and phone to be
returned in a single line.
Any suggestion to do this through sql stmt.create table TEMP_AAAAA ( FIRST_NAME VARCHAR2(25), LAST_NAME VARCHAR2(25), CON_METHOD VARCHAR2(25), CON_VALUE VARCHAR2(25) ) INSERT INTO TEMP_AAAAA VALUES('TOM','MAC','EMAIL','[email protected]'); INSERT INTO TEMP_AAAAA VALUES('TOM','MAC','PHONE','12345');
I did it through pl/sql, I wondered if it could be realized only thru SQL StmtDECLARE v_FIRST_NAME VARCHAR2(25); v_SECOND_NAME VARCHAR2(25); v_EMAIL VARCHAR2(25); v_PHONE VARCHAR2(25); BEGIN v_FIRST_NAME := NULL; v_SECOND_NAME := NULL; v_EMAIL := NULL; v_PHONE := NULL; FOR IMPL_CUR IN(SELECT * FROM TEMP_AAAAA ORDER BY CON_METHOD DESC) LOOP IF v_FIRST_NAME IS NULL THEN v_FIRST_NAME := IMPL_CUR.FIRST_NAME; END IF; IF v_SECOND_NAME IS NULL THEN v_SECOND_NAME := IMPL_CUR.LAST_NAME; END IF; IF v_PHONE IS NULL AND IMPL_CUR.CON_METHOD = 'PHONE' THEN v_PHONE := IMPL_CUR.CON_VALUE; END IF; IF v_FIRST_NAME = IMPL_CUR.FIRST_NAME AND v_SECOND_NAME = IMPL_CUR.LAST_NAME AND length(v_PHONE) > 0 THEN IF v_EMAIL IS NULL AND IMPL_CUR.CON_METHOD = 'EMAIL' THEN v_EMAIL := IMPL_CUR.CON_VALUE; EXIT; END IF; END IF; END LOOP; DBMS_OUTPUT.put_line('firstName...:' || v_FIRST_NAME); DBMS_OUTPUT.put_line('lastName....:' || v_SECOND_NAME); DBMS_OUTPUT.put_line('PHONE.......:' || v_PHONE); DBMS_OUTPUT.put_line('EMAIL.......:' || v_EMAIL); END;
SELECT FIRST_NAME, LAST_NAME,
MAX (SUBSTR (SYS_CONNECT_BY_PATH (CON_VALUE,' '), 2)) EMP_LIST
(SELECT FIRST_NAME, LAST_NAME, CON_VALUE,
ROW_NUMBER() OVER (PARTITION FIRST_NAME, LAST_NAME ORDER BY CON_METHOD) RN
OF TEMP_AAAAA)
CONNECT BY PRIOR (FIRST_NAME |) LAST_NAME. =(FIRST_NAME||) RN) LAST_NAME. (RN-1))
START BY RN = 1
GROUP FIRST_NAME, LAST_NAME;FIRST_NAME LAST_NAME EMP_LIST
------------------------- ------------------------- ------------------------------------------------
TOM MAC [email protected] 12345 -
Priv required for the user to export the design to the scheme of Reporting account
We are trying to put in place an outline report, but do not want to share the password of schema with all the proponent to avoid dropping the repository or removing drawings.
Can we create another user account and the same share with developers/modelers so that they can still continue to export the notification schema design.
If so, can you pls help us leaving what privs are required to consider that account or configuration required for the same.
Thank you
MurarisBy using the developer user trying to get the version of the repository
SELECT DMRS_Persistence_Version from DMRS_INSTALLATION
If it says "Table or view does not exist" there is something wrong with synonyms.You use Data Model 3.0 and repository is created with it, right?
Have you used my script? I guess there is no runtime error. -
I am trying to create a dynamic sql to execute the following statement:
create the table mytbl_20100901 in select * from matbl double;
When I try the following error I
ORA-06550: line 6, column 10:
PLS-00103: encountered the symbol "SELECT" at the expected in the following way:
;;;;;;;;;;;;;;;;;;;;;;;;;;;
declare
sql_cmd varchar2 (1000);
Start
sql_cmd: = select "create table mytbl_ | To_char (sysdate, 'YYYYMMDD') | ' in select * from matbl ' double.
immediately run sql_cmd;
end;
;;;;;;;;;;;;;;;;;;;;;;;;;
How to fix the sql_cmd assignment statement?
Thank you.Hello
user1035690 wrote:
I am trying to create a dynamic sql to execute the following statement:create the table mytbl_20100901 in select * from matbl double;
When I try the following error I
ORA-06550: line 6, column 10:
PLS-00103: encountered the symbol "SELECT" at the expected in the following way:;;;;;;;;;;;;;;;;;;;;;;;;;;;
declare
sql_cmd varchar2 (1000);Start
sql_cmd: = select "create table mytbl_ | To_char (sysdate, 'YYYYMMDD') | ' in select * from matbl ' double.
immediately run sql_cmd;
end;
;;;;;;;;;;;;;;;;;;;;;;;;;How to fix the sql_cmd assignment statement?
Thank you.
The dual table is not necessary a lot in PL/SQL.
You can simply say:sql_cmd := 'create table mytbl_' || TO_CHAR(sysdate, 'YYYYMMDD') || ' as select * from mytbl'; dbms_output.put_line (sql_cmd || ' <= sql_cmd'); -- EXECUTE IMMEDIATE sql_cmd;
During the development of the dynamic SQL statements, I suggest that you post the command rather than run it first.
When it seems correct, then a comment instructions EXECUTE IMMEDIATE.
Before the Production code, remove or comment the call to out_line. -
Retrieve and display a result set using the dynamic sql?
Hi all
How would display a result set in Oracle using the dynamic SQL? Reason being, the table where I'd retrieve and display the result set is a GLOBAL TEMP TABLE created in a stored procedure. If I try to use the loop as usual, the compiler complains that the table does not exist. This makes sense because the compiler does not recognize the table because it is created dynamically. Here is an example:
create or replace PROCEDURE maketemptab IS
sql_stmt VARCHAR2 (500);
OutputString VARCHAR2 (50);
BEGIN
-create temporary table
sql_stmt: = ' CREATE of TABLE TEMPORARY GLOBAL globtemptab (id NUMBER, col1 VARCHAR2 (50))';
EXECUTE IMMEDIATE sql_stmt;
dbms_output.put_line ('... created table ');
-Insert a row into the temporary table
sql_stmt: = "INSERT INTO globtemptab values (1, 'some data of a test')';"
EXECUTE IMMEDIATE sql_stmt;
dbms_output.put_line ('... inserted row ');
-Insert a row into the temporary table
sql_stmt: = ' INSERT INTO globtemptab values (2, "some more test data");
EXECUTE IMMEDIATE sql_stmt;
dbms_output.put_line ('... inserted row ');
-Select the row on temporary table
sql_stmt: = 'SELECT col1 FROM globtemptab WHERE id = 1';
EXECUTE IMMEDIATE sql_stmt INTO outputstring;
dbms_output.put_line ('... selected line: ' | outputstring);
-drop temporary table
sql_stmt: = 'DROP TABLE globtemptab;
EXECUTE IMMEDIATE sql_stmt;
dbms_output.put_line ('... moved table ');
-display the result set
for tabdata loop (select col1 from globtemptab)
dbms_output.put_line ('... test of recovered data are' | tabdata.col1)
end loop;
end;
In short, how to rewrite the SQL below the comment "to display the result set" using the dynamic sql?
Thank you
Amedeo.Hello
Try this:
CREATE OR REPLACE PROCEDURE maketemptab IS sql_stmt VARCHAR2(500); outputstring VARCHAR2(50); v_cursor SYS_REFCURSOR; v_col1 VARCHAR2(30); BEGIN -- create temp table sql_stmt := 'CREATE GLOBAL TEMPORARY TABLE globtemptab(id NUMBER, col1 VARCHAR2(50))'; EXECUTE IMMEDIATE sql_stmt; dbms_output.put_line('...table created'); -- insert row into temp table sql_stmt := 'INSERT INTO globtemptab values (1, ''some test data'')'; EXECUTE IMMEDIATE sql_stmt; dbms_output.put_line('...row inserted'); -- insert row into temp table sql_stmt := 'INSERT INTO globtemptab values (2, ''some more test data'')'; EXECUTE IMMEDIATE sql_stmt; dbms_output.put_line('...row inserted'); -- select row from temp table sql_stmt := 'SELECT col1 FROM globtemptab WHERE id=1'; EXECUTE IMMEDIATE sql_stmt INTO outputstring; dbms_output.put_line('...row selected: ' || outputstring); OPEN v_cursor FOR 'SELECT col1 FROM globtemptab'; LOOP FETCH v_cursor INTO v_col1; EXIT WHEN v_cursor%NOTFOUND; dbms_output.put_line('...test data retrieved is' || v_col1); END LOOP; CLOSE v_cursor; -- drop temp table sql_stmt := 'DROP TABLE globtemptab'; EXECUTE IMMEDIATE sql_stmt; dbms_output.put_line('...table dropped'); END; /
Kind regards
-
How to create the dynamic list item in the designer of Site Studio?
Hi all
I installed the Site Studio Designer(10gR4). The dynamic list item that I added in the region of contributor runs a query to search and display all the files in a particular folder. In Contributor mode when I try to add/edit the dynamic list item, it gives an error saying:
Cannot perform the action for the following reasons:
[+] Failed to retrieve search results. Failed to retrieve search results. Failed to create the result set of query ' SELECT IdcColl2.dID, dDocName, dDocTitle, dDocType, dRevisionID, dSecurityGroup, dDocAuthor, dDocAccount, dRevLabel, dFormat, dOriginalName, venture, dWebExtension, dInDate, dOutDate, dCreateDate, dPublishType, dRendition1, dRendition2, VaultFileSize, WebFileSize, URL, dFullTextFormat, dFullTextCharset, DocMeta.* FROM IdcColl2, DocMeta WHERE IdcColl2.dID = DocMeta.dID AND (((xCollectionID > = 14 ET xCollectionID < = 14) AND NOT ((CONTAINS (xDontShowInListsForWebsites, '{DIPP_Sample}") > 0))) ORDER BY dDocTitle desc".) ORA-20000: Oracle text error: 10599-DRG: column is not indexed
I activated the full text on the content server search and also included xWebsites and xWebsiteObjectType columns to be fully indexed in the fields Configuration.Is area it any other setting to do? Help, please.
Thank you
NithyaHello
Include the xDontShowInListsForWebsites also of the area filed and then update it. Then test it.
It may be useful
Srinath -
Generation of a dynamic value through pl/sql in shell.
Hi all
Generation of a dynamic value through pl/sql in shell.
host_command ("echo" Insert into CUSTOM (FIRSTNAME) VALUES ("| v_temp |");) « ») ;
Output current:
Insert into CUSTOMERS (FIRSTNAME) VALUES (John);
power required:
Insert into CUSTOMERS (FIRSTNAME) VALUES ('John');
Thank you.Your request must so->
host_command ('echo " Insert into CUSTOM (FIRSTNAME) VALUES ('||chr(39)||v_temp||chr(39)||');" ');
Kind regards.
LOULOU.
-
Pneumatic schema / proportionally correct wheel of the dynamic circle
Hi, I use actionScript to dynamically draw a diagram of a wheel with tire, but it made its appearance the right size. The diagram should be drawn using three pieces of incoming information (from JavaScript):
num_wd_mm (diameter of the wheel) is the diameter of the metal wheel, which fits the tyre rubber.
num_ph_mm (height) = the height of inside outside the tire rubber itself.
num_ODmm (overall diameter) = the diameter of the whole thing (wheel diam + height profile)
Sounds simple, isn't? But it is difficult to do the math necessary to draw the diagram with precision, because the diameter of the wheel is represented by a full circle and the circle race tire. The width of the line is the circumference of the circle filled with half and half inside the outer edge.
The key is the correct outline width, while represents the tire rubber with precision, it compensates for the fact that it is only the display outside the circle of half of its width, and he rides inside the circle by half of its width also (fill circle should appear to be is the diameter of the wheel because it's what he represents in the diagram.)
Here is how I had tried it, but I can see that the overall diameter is wrong:
/ / The scale for the graph is:
var MMtoPX:Number = 3.5;
//Set vars for dynamic circle
var strokeWidth:Number = num_ph_mm/MMtoPX;
var circleRadius:Number = ((num_ODmm+num_wd_mm)/2) / MMtoPX;
/ / Draw the dynamic circle
circle.graphics.clear ();
circle.graphics.lineStyle (strokeWidth, 0x000000);
circle.graphics.beginFill (0x0000FF);
circle.graphics.drawCircle (circleX, circleY, circleRadius);
circle.graphics.endFill ();
Initially, it seemed that it would be simple, but all combinations possible amounts that I try produces incorrect results.
In addition to what AHernandezIP, traits are overlapping fills (half of the thickness of line) - it's one of the reasons why is not worth trying to find adequate compensation. If, say, a circle radius is 100 and accident stroke is 20 - combined radius of the circle that results will be 120 (100 + 10 on each side). So, it is much easier to draw two circles. One of the ways:
var circle:Sprite = new Sprite(); var gr:Graphics = circle.graphics; var outerRadius:Number = 100; var innerRadius:Number = 60; // draw two crcles in one swap gr.beginFill(0x6C0000); // draw bigger one gr.drawCircle(0, 0, outerRadius); gr.endFill(); // change fill color gr.beginFill(0xC0C0C0); // draw smaller circle gr.drawCircle(0, 0, innerRadius); gr.endFill(); addChild(circle); circle.x = circle.y = 100;
Maybe you are looking for
-
Any application under the first line of the application will not run. This tv, Appstore, photos and music, movies - running all these very well. But YouTube, computers, funny or die, etc. - these all results in a white screen and it just hangs there
-
"'A problem similar to others that have already been posted. I use "Open FPGA VI reference" (whether with a bit file or a VI) and then pass out this VI and in a series of reference face. It works fine until I do any kind of change to say "Open FPGA V
-
I get a 7601 "this copy of windows is not genuine" on my computer refurbished
I get a 7601 This copy of windows is not genuine ? (windows 7) Windows Edition home premium Moved from the community involvement Center Original title: on refurbished computers
-
BlackBerry Smartphones how can I extend the amount of time my phone rings?
Why did when I get a call the phone only rings 2 times and at the time wherever I go out of the box, he hangs up and goes to voicemail.
-
BlackBerry® Smartphones email opens on the old message
Every time I open my email it will the same message from a month ago. How can I get the email to open the current date or a more recent message?