Error when using native dynamic SQL
Please can someone help me understand what's wrong with my code.
Code:
create or replace procedure p1 (name varchar2)
as
Start
run immediately "select * from ' |" name;
end;
/
Goal: Just to test the native dynamic SQL code using a placeholder.
COmpliation:
SQL > create or replace procedure p1 (name varchar2)
2 as
3
4 start
5 run immediately "select * from ' |" name;
6 end;
7.
Created procedure.
Error:
SQL > exec p1 ('employees');
BEGIN p1 ('employees'); END;
*
ERROR on line 1:
ORA-00923: THE KEYWORD not found where expected
ORA-06512: at "HR. "P1", line 5
ORA-06512: at line 1
SQL >
You need a space after the clause 'from', like this:
run immediately "select * from ' |" name;
Tags: Database
Similar Questions
-
Tables created in a stored procedure cannot be used with dynamic SQL? The impact?
There is a thread on the forum which explains how to create tables within a stored procedure (How to create a table in a stored procedure , however, it does create a table as such, but not how to use it (insert, select, update, etc.) the table in the stored procedure.) Looking around and in the light of the tests, it seems that you need to use dynamic SQL statements to execute ddl in a stored procedure in Oracle DB. In addition, it also seems that you cannot use dynamic SQL statements for reuse (insert, select, update, etc.) the table that was created in the stored procedure? Is this really the case?
If this is the case, I am afraid that if tables cannot be 'created and used"in a stored procedure using the dynamic SQL, as is the case with most of the servers of DB dynamic SQL is not a part of the implementation plan and, therefore, is quite expensive (slow). This is the case with Oracle, and if yes what is the performance impact? (Apparently, with Informix, yield loss is about 3 - 4 times, MS SQL - 4 - 5 times and so on).
In summary, tables created within a stored procedure cannot be 'used' with dynamic SQL, and if so, what is the impact of performance as such?
Thank you and best regards,
Amedeo.
Published by: AGF on March 17, 2009 10:51AGF says:
Hi, Frank.Thank you for your response. I understand that the dynamic SQL is required in this context.
Unfortunately, I am yet to discover "that seeks to" using temporary tables inside stored procedures. I'm helping a migration from MySQL to Oracle DB, and this was one of the dilemmas encountered. I'll post what is the attempt, when more.
In Oracle, we use [global temporary Tables | http://www.psoug.org/reference/OLD/gtt.html?PHPSESSID=67b3adaeaf970906c5e037b23ed380c2] aka TWG these tables need only be created once everything like a normal table, but they act differently when they are used. The data inserted in TWG will be visible at the session that inserted data, allowing you to use the table for their own temporary needs while not collide with them of all sessions. The data of the TWG will be automatically deleted (if not deleted programmatically) when a) a commit is issued or b) the session ends according to the parameter that is used during the creation of the TWG. There is no real need in Oracle to create tables dynamically in code.
I noticed that many people say that the "Creation of the tables within a stored procedure" is not a good idea, but nobody seems necessarily explain why? Think you could elaborate a little bit? Would be appreciated.
The main reason is that when you come to compile PL/SQL code on the database, all explicit references to tables in the code must correspond to an existing table, otherwise a djab error will occur. This is necessary so that Oracle can validate the columns that are referenced, the data types of those columns etc.. These compilation controls are an important element to ensure that the compiled code is as error free as possible (there is no accounting for the logic of programmers though ;)).
If you start to create tables dynamically in your PL/SQL code, so any time you want to reference this table you must ensure that you write your SQL queries dynamically too. Once you start doing this, then Oracle will not be able to validate your SQL syntax, check the types of data or SQL logic. This makes your code more difficult to write and harder to debug, because inevitably it contains errors. It also means that for example if you want to write a simple query to get that one out in a variable value (which would take a single line of SQL with static tables), you end up writing a dynamic slider all for her. Very heavy and very messy. You also get the situation in which, if you create tables dynamically in the code, you are also likely to drop tables dynamically in code. If it is a fixed table name, then in an environment multi-user, you get in a mess well when different user sessions are trying to determine if the table exists already or is the last one to use so they can drop etc. What headache! If you create tables with table names, then variable Dynamics not only make you a lot end up creating (and falling) of objects on the database, which can cause an overload on the update of the data dictionary, but how can ensure you that you clean the tables, if your code has an exception any. Indeed, you'll find yourself with redundant tables lying around on your database, may contain sensitive data that should be removed.
With the TWG, you have none of these issues.
Also, what is the impact on the performance of the dynamic SQL statements in Oracle? I read some contrasting opinions, some indicating that it is not a lot of difference between static SQL and SQL dynamic in more recent versions of Oracle DB (Re: why dynamic sql is slower than static sql is this true?)
When the query runs on the database, there will be no difference in performance because it is just a request for enforcement in the SQL engine. Performance problems may occur if your dynamic query is not binding variable in the query correctly (because this would cause difficult analysis of the query rather than sweet), and also the extra time, to dynamically write the query running.
Another risk of dynamic query is SQL injection which may result in a security risk on the database.
Good programming will have little need for the tables of dynamically created dynamically or SQL.
-
dbms_crypto - avoid error when using different key in lower environment
Hello Experts,
We use Oracle 11.2.0.2. We intend to implement dbms_crypto to encrypt some columns. Clone us the production data at the lower environment (DEV, QC).
The lowest environments, we do not want to obtain the sensitive data from production and do not plan to use the same key. Instead of getting an error when using different keys, is it possible to get a different set of results.
In other words, we want the implementation will be same in environments but use a different key in lower environment and obtain different results (or garbage).
Any suggestions would be greatly appreciated.
The test of this logic, I get following error when using the different keys to decrypt. It works fine if I use the same key.
Error on line 1
ORA-28817: PL/SQL function has returned an error.
ORA-06512: at "SYS." DBMS_CRYPTO_FFI', line 67
ORA-06512: at "SYS." DBMS_CRYPTO", line 44
ORA-06512: at line 19
Thank you.DECLARE l_credit_card_no VARCHAR2(19) := '1234 5678 9012 3456'; l_ccn_raw RAW(128) := UTL_RAW.cast_to_raw(l_credit_card_no); l_key RAW(128) := UTL_RAW.cast_to_raw('abcdefgh'); l2_key RAW(128) := UTL_RAW.cast_to_raw('12345678'); l_encrypted_raw RAW(2048); l_decrypted_raw RAW(2048); BEGIN DBMS_OUTPUT.put_line('Original : ' || l_credit_card_no); l_encrypted_raw := DBMS_CRYPTO.encrypt(src => l_ccn_raw, typ => DBMS_CRYPTO.des_cbc_pkcs5, key => l_key); DBMS_OUTPUT.put_line('Encrypted : ' || RAWTOHEX(UTL_RAW.cast_to_raw(l_encrypted_raw))); l_decrypted_raw := DBMS_CRYPTO.decrypt(src => l_encrypted_raw, typ => DBMS_CRYPTO.des_cbc_pkcs5, key => l2_key); --**Using different key to decrypt DBMS_OUTPUT.put_line('Decrypted : ' || UTL_RAW.cast_to_varchar2(l_decrypted_raw)); END;
In general, you can't get different results in different environments, no.
Of course, you could write your routine to decrypt so that it intercepts it and returns a random string of RAW.
However, this is not normally the way people go on hiding sensitive data in environments below. It would be much more common to use a tool that is designed for this tool. For example, Oracle has a Pack of masking of data for Enterprise Manager that allows to replace sensitive data with false, but realistic data as part of the updating of the environments below. There are also data from third-party tools like masqueur datamasking.
Justin
-
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
-
Receive the 25 (Null) error when using Flightsimulator FSX
Receive the 25 (Null) error when using Flightsimulator FSX
Hello
Try to open the it to start - all programs - Games - Games Explorer, and then clicking the icon FSX.
A disk error of 25 means that the program cannot read your disk reading. Either the disc is scratch, dirty or defective. If you need another drive, or you can try it on another computer. The message of Visual elements of Vista is not serious. Vista will automatically your screen to a basic compatible mode when the application is launched. However, it seems that your game is a failure due to the disk error and not the Vista display problem. Try to clean the disc and see if that helps.
Last resort, it seems you'd have to do a complete uninstall and reinstall FSX.
Cheers!
-
Hi all
I'm moving a table as a variable in dynamic SQl but with no result. Suppose that I it running on HR diagram example:
I get this error of invalid table name without knowing what was read for the variable. Any advice?declare sql_state varchar(100); hire_date date; temp_table varchar(9):='employees'; begin sql_state:= 'select hire_date from :1 where employee_id=206'; execute immediate sql_state into hire_date using temp_table; dbms_output.put_line('hire_date is '||hire_date); end; declare * ERROR at line 1: ORA-00903: invalid table name ORA-06512: at line 9
Best regards
ValHi Valerie,
To add to what Peter, said
"Binding" values in a query is done for a specific purpose, and this purpose is so that the optimizer can use the same query as the previous execution plan runs the query, which prevent it from having to analyze the hard the query each time. A query execution plan is based on the tables and columns are presented in the query, but with respect to the actual "values" of these columns, they are unlikely to change the execution plan. So, to keep the same execution plan, the query must seem identical (in terms of a query string) like the previous series, so if you want the same query, but just with different values, they can be replaced with bind variables (these things have a ': ' character) and then the values passed in the query, when it is run.
Now, if Oracle were to allow you to link in the names of objects, such as tables, this means that it could not use the previous execution plans, because he doesn't know until run time what tables will be consulted. Therefore, it would be useless link in the values of the query and it would be just as quick to implement your query string by concatenating all the values inside rather than link them. Considering that a query is parsed first and then the values in it, then it cannot be analyzed if the tables are not known everything first. (Take a look at how queries are formed and variables when you use the DBMS_SQL package).
So the key thing to remember is that, when it comes to bind variables, you can bind only the 'values', not 'objects '.
-
value of the element is not common when used in dynamic action
I'm learning the 5 apex and I wanted to create a page that would update the fields in a record by entering the unique id of the recording using a dynamic action with plsql.
When I click on the button update the value of the element of the text uses the previous value and not the input current. The 'works' update, but the ID values are not appropriate.
How can I make sure that when I click on the update button, the dynamic action will get the current value of the text element and not the previous (when the page was submitted)?
I created a quick demo or what I was testing in apex.oracle.com and always gives me the same result.
dacoellov wrote:
I'm learning the 5 apex and I wanted to create a page that would update the fields in a record by entering the unique id of the recording using a dynamic action with plsql.
When I click on the button update the value of the element of the text uses the previous value and not the input current. The 'works' update, but the ID values are not appropriate.
How can I make sure that when I click on the update button, the dynamic action will get the current value of the text element and not the previous (when the page was submitted)?
I created a quick demo or what I was testing in apex.oracle.com and always gives me the same result.
What dynamic action event and what types of action are involved here? Provide details, or better yet share identification information of developer comments for the apex.oracle.com workspace so that we can see the demo.
If the dynamic action executes an SQL statement or a PL/SQL process on the server that requires page updated element values in session state, specify these items as part of dynamic action Page to submit items .
-
2 + GB in plsql zip file. Error when using as_zip
I use as_zip package of Anton Scheffer http://technology.amis.nl/wp-content/uploads/images/as_zip.txt
When you try to compress a 2 + GB file I get the following error
ORA-06502: PL/SQL: digital error or value
ORA-06512: at "SYS." UTL_RAW', line 380
ORA-06512: at "SANJEEV.AS_ZIP", line 321
ORA-06512: at "SANJEEV.AS_ZIP", line 356
ORA-06512: at line 4 level
06502 00000 - "PL/SQL: digital error or the value of %s.
* Cause:
* Action:
The error is triggered by the little_endian function.
function little_endian)
p_big number
, p_bytes in pls_integer: = 4
)
Return to raw
is
Start
return utl_raw.substr
(utl_raw.cast_from_binary_integer (p_big
utl_raw.little_endian
)
1
p_bytes
);
end;
The function uses utl_raw.cast_from_binary_integer. I tried to use utl_raw.cast_from_number, but did not create the correct zip file. Does anyone has found a fix for this error? The package works fine for smaller files - many thanks to Anton.
If you change the little_endian function in the package of files with a length between 2 and 4 GB you can zip
function little_endian (p_big number, p_bytes pls_integer: = 4)
Return to raw
is
number of t_big: = p_big;
Start
If t_big > 2147483647
then
t_big: = t_big - 4294967296;
end if;
Return utl_raw.substr (utl_raw.cast_from_binary_integer (t_big, utl_raw.little_endian), 1, p_bytes);
end;
And if you change your blog2num you can read them again
function blob2num (blob, aureliepally, of p_pos p_blob)
Return number
is
number of RV;
Start
RV: = utl_raw.cast_to_binary_integer (dbms_lob.substr (p_blob, aureliepally, p_pos), utl_raw.little_endian);
If rv<>
then
RV: = VR + 4294967296;
end if;
Return rv;
end;
Compress a file of this size will take time, on my database 11XE 15 minutes.
Also, I just saw that this zip/unzip code is included in the ea APEX 5.0 version, named wwv_flow_zip
-
ODBC error when implementing applications on SQL Server BI
Hey,.
We are implementing BI applications using SQL Server as the database of the warehouse, and we run in the following errors when viewing reports out-of-the-box:
[ODBC SQL Server driver] [SQL Server] 'concat' is not a recognized built-in function name
[ODBC SQL Server driver] [SQL Server] Incorrect syntax near 'NULL '...
It seems that the standard reports using Oracle SQL-specific features that are not available in SQL Server. BI Apps is still supposed to be certified with SQL Server.
No matter who else experience this problem? If so, how have you around her?
Thank you
YiMake sure that your database in the physical layer supports the CONCAT function.
-
Error when inserting in dynamically created filename-file
Howry
Me get the following error when I try to insert in a file with a dynamic file name (thanks to the declared variable, date etc.).
I presume that she strives to find the file target with the same name as the dynamic value crossed by the variable, but don't find it: can someone tell me how I can create rather the file as affixes of y to insert a file already created... ?
Your help in this regard is highly appreciated.
Here is the error:
ODI-1217: SAPO_hlr_suburbs Session (1577001) fails with return code 7000.
ODI-1226: 6_Ins_final step fails after 1 attempt.
ODI-1240: Debit 6_Ins_final fails during an operation of integration. This flow of charge target table #l_date.unl.
ODI-1228: 6_Ins_final (integration) task fails on FILES SAPO_HLR_SUBURBS connections target.
Caused by: java.sql.SQLException: file C:\Files\Gero work\ODI 12:06:13.463.unl in Files\SAPO_HLR_SUBURBS/2012-01-24 has not been found.
at com.sunopsis.jdbc.driver.file.FileConnection.prepareForWriting(FileConnection.java:339)
at com.sunopsis.jdbc.driver.file.impl.commands.CommandInsert.execute(CommandInsert.java:50)
at com.sunopsis.jdbc.driver.file.CommandExecutor.executeCommand(CommandExecutor.java:33)
at com.sunopsis.jdbc.driver.file.FilePreparedStatement.executeUpdate(FilePreparedStatement.java:138)
at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java:665)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeUpdate(SnpSessTaskSql.java:3218)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders(SnpSessTaskSql.java:1785)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2805)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java:68)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:322)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:246)
to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:237)
to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:794)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:619)Good things - I've had similar when pain started working with varying dates/times - remember that ODI is manipulated as Java dates, you can mark the thread as closed and award marks for correct answers please :-)
-
Hello
I get a strange error when I try to use a plugin.
On page 5 of the Wizard after you press on create a new element on a region, it gives me the following error:
ORA-06502 pl sql numeric or value error character string too small buffer
I guess that's the page where the wizard is supposed to show me the attributes of plugins, because if I continue the wizard I have all of the attributes listed in the plugin either.
Anyone knows what is the cause?
Here is the error:
http://test.Kolonist.dk/SQL_ERROR.jpgHello
Yes, this is a known issue that will be fixed in our 4.0.2 group of hotfixes.
Concerning
Patrick
-----------
My Blog: http://www.inside-oracle-apex.com
APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
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. -
In Oracle 10 g error when using COLLECT
I get the error when you use collect in 10g
SQL > ed
A written file afiedt.buf
1. SELECT deptno
2, COLLECT (ename) AS PGE
3 FROM emp
GROUP 4 BY
5 * deptno
SQL > /.
COLLECT (ename) AS PGE
*
ERROR on line 2:
ORA-00932: inconsistent data types: expected NUMBER obtained -
Please give me the solution.you use the old version of SQL * more. If you use the later version, it will give you correct the result.
Published by: ūnōrum on March 14, 2010 04:25
-
Hello
I went for a package listing
When I run the select statement in a SQL PLUS, it gives the result.
But when I try to use the same sql P_out_member OPEN for statement statement I'm unable to compile the package. I'm getting
PLS-00103 found 'string', but expected one of the following values: 'chain' "}, error"
Help, please.
Open P_out_member for SELECT x.memberid, x.alt_id, x.memfirstname, x.memlastname, x.meminitial, x.dob_dte, x.sex, x.street, x.city, x.state, x.zip, x.phone_number, x.LOB, x.elig_dte, NVL ((SELECT 'Y' FROM www_phr_extension phr WHERE phr.ghi_prov_num = '000000082295' AND phr.cert_no = x.hmo_certno AND phr.rec_code = x.rec_code AND ROWNUM = 1), 'N' ) phr_ind FROM (SELECT DISTINCT m.alt_id || '0' || SUBSTR (m.rec_code, -1, 1) AS memberid, m.alt_id, m.hmo_certno, m.rec_code, m.pat_firstname AS memfirstname, m.pat_lastname AS memlastname, m.pat_mi AS meminitial, TO_CHAR (TO_DATE (m.mem_dob, 'yyyymmdd'), 'mm/dd/yyyy' ) AS dob_dte, DECODE (SUBSTR (r.description, -4, 4), 'male', 'F', 'Male', 'M', 'N/A' ) AS sex, DECODE (a.street1, '', 'N/A', a.street1 || ' ' || a.street2 ) AS street, DECODE (a.city, '', ' ', a.city) AS city, DECODE (a.state, '', ' ', a.state) AS state, DECODE (a.zip_code, '', ' ', a.zip_code) AS zip, DECODE (SIGN (ASCII (g.comm_nmbr) - 57), 1, 'N/A', '', 'N/A', g.comm_nmbr ) AS phone_number, 'GHI HMO' AS LOB, TO_CHAR (TO_DATE (m.eff_date, 'yyyymmdd'), 'mm/dd/yyyy' ) AS elig_dte FROM mv_hmo_med_subscriber m, gos_subscriber_pcp c, subscriber_relation r, med_address a, (SELECT gs.cert_no, gs.rec_code, gs.comm_type, gs.comm_nmbr FROM gos_subscriber_comm gs WHERE gs.comm_type = 'HP') g WHERE m.hmo_certno = c.cert_no AND m.term_date = '00000000' AND m.rec_code = c.rec_code AND m.rel_code = r.rel_code(+) AND m.cert_no = a.cert_no(+) AND m.rec_code = a.rec_code(+) AND m.cert_no = g.cert_no(+) AND m.rec_code = g.rec_code(+) AND c.ghi_prov_num = '000000082295' AND ( (p_in_member_id IS NULL OR p_in_member_id = '' ) OR ( m.alt_id = p_member_id AND m.rec_code = p_rec_code ) ) AND ( ( p_in_member_last_name IS NULL OR p_in_member_last_name = '' ) OR m.pat_lastname = p_in_member_last_name )) x ORDER BY x.memlastname
You can try below
Open P_out_member for SELECT x.memberid, x.alt_id, x.memfirstname, x.memlastname, x.meminitial, x.dob_dte, x.gender, x.street, x.city, x.state, x.zip, x.phone_number, x.lob, x.elig_dte, NVL (y.phr_ind, 'N') phr_ind FROM (SELECT DISTINCT m.alt_id || '0' || SUBSTR (m.rec_code, -1, 1) AS memberid, m.alt_id, m.hmo_certno, m.rec_code, m.pat_firstname AS memfirstname, m.pat_lastname AS memlastname, m.pat_mi AS meminitial, TO_CHAR (TO_DATE (m.mem_dob, 'yyyymmdd'), 'mm/dd/yyyy') AS dob_dte, DECODE (SUBSTR (r.description, -4, 4), 'male', 'F', 'Male', 'M', 'N/A' ) AS gender, DECODE (a.street1, '', 'N/A', a.street1 || ' ' || a.street2 ) AS street, DECODE (a.city, '', ' ', a.city) AS city, DECODE (a.state, '', ' ', a.state) AS state, DECODE (a.zip_code, '', ' ', a.zip_code) AS zip, DECODE (SIGN (ASCII (g.comm_nmbr) - 57), 1, 'N/A', '', 'N/A', g.comm_nmbr ) AS phone_number, 'GHI HMO' AS lob, TO_CHAR (TO_DATE (m.eff_date, 'yyyymmdd'), 'mm/dd/yyyy') AS elig_dte FROM mv_hmo_med_subscriber m, gos_subscriber_pcp c, subscriber_relation r, med_address a, (SELECT gs.cert_no, gs.rec_code, gs.comm_type, gs.comm_nmbr FROM gos_subscriber_comm gs WHERE gs.comm_type = 'HP') g WHERE m.hmo_certno = c.cert_no AND m.term_date = '00000000' AND m.rec_code = c.rec_code AND m.rel_code = r.rel_code(+) AND m.cert_no = a.cert_no(+) AND m.rec_code = a.rec_code(+) AND m.cert_no = g.cert_no(+) AND m.rec_code = g.rec_code(+) AND c.ghi_prov_num = '000000082295' AND ( (p_in_member_id IS NULL OR p_in_member_id = '') OR (m.alt_id = p_member_id AND m.rec_code = p_rec_code)) AND ( (p_in_member_last_name IS NULL OR p_in_member_last_name = '') OR m.pat_lastname = p_in_member_last_name)) x LEFT OUTER JOIN (SELECT DISTINCT phr.cert_no, phr.rec_code, 'Y' phr_ind FROM www_phr_extension phr WHERE phr.ghi_prov_num = '000000082295') y ON y.cert_no = x.hmo_certno AND y.rec_code = x.rec_code ORDER BY x.memlastname
I think THAT this could be a problem
NVL ((SELECT 'Y' FROM www_phr_extension phr WHERE phr.ghi_prov_num = '000000082295' AND phr.cert_no = x.hmo_certno AND phr.rec_code = x.rec_code AND ROWNUM = 1), 'N' ) phr_ind
-
Tecra 8100 system error when using Bank B
Hello
I get Bluscreens and system errors when you use Bank B. When you use Module1 in the Bank, everything is ok. When the same module as Bank A Bank (Bank A + B) b, I get errors.
So, what would it be? What I have to 'turn on' the use of BANK B anywhere or not it looks like its defekt?
Thanks for any help
Hello
Well, you must replace the motherboard if the memory bank has a defect. In this case, the only good way to connect with the service partner. They might give you detailed information.
Good bye
Maybe you are looking for
-
L10: Using a simple click for extended desktop
Hello I use a satellite L10 for presentations. Is it possible to implement the extended one-click Desktop (a! via .exe, .reg,... file, etc.)? (A quick access key would be nice too) The problem is that if I start the computer without the external moni
-
I got a phone call from a person claiming to be from the care team of the windows service how they got my number and I took his number, I think it's fake
-
Hello When you configure UCS Manager 2.0 to authenticate from a vendor LDAP (Active Directory) I m somewhat unclear if the "Attribute" field is required or not when the LDAP provider is configured? According to the Configuration Guide 137 page, it is
-
How Business Service (file protocol) can read the location of the server XML file
Hi Experts,I have a use case where I have to expose a Web service and as a response, I send a large xml (size max would be 18 MB).Customer - ProxyService (exposed as a Web service) - BusinessService (File protocol) < - read - > File.xmlHere the xml r
-
I installed CC Office om my laptop some time ago. All of the CC Apps and updates work perfectly on this laptop.For about half a year, the apps also worked well on my PC (Windows 7 Pro Service Pack 1).I recently upgraded to Photoshop, Illustrator, Acr